[SOLVED] Scrollview on android device



  • Hi there,

    is it possible to disable horizontal scrolling on a ScrollView? I got a different behavior on my mac and on the android device. On my android device if I touch and hold a element of the ScrollView I can draw or move the element in all directions and if I release it with my finger it jumps back its origin.

    How can I avoid this?


  • Moderators

    Hi,

    To disable horizontal scrolling on ScrollView, try this:
    @
    ScrollView {
    Image { source: "15686.jpg" }
    flickableItem.onContentXChanged: flickableItem.contentX = 0
    }
    @



  • That workaround will probably cause problems. I would suggest that you instead try:
    @
    ScrollView {
    Image { source: "15686.jpg" }
    flickableItem.flickableDirection: Flickable.VerticalFlick
    }
    @



  • Thanks, that solved my problem!



  • how to make the center item (anchors.centerIn: appWindow.center) was scrolling ?
    @import QtQuick 2.2
    import QtQuick.Controls 1.1
    import QtQuick.Window 2.0
    ApplicationWindow{
    id: appWindow
    visible: true
    width:Screen.width
    height:Screen.height
    ScrollView
    {
    anchors.fill: parent
    Rectangle
    {
    width: 800
    height: 800
    color : "yellow"
    anchors.centerIn: appWindow.center
    }
    }
    }@


  • Moderators

    +1 Jens for the exact solution.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.