[SOLVED] Scrollview on android device
-
wrote on 8 Dec 2014, 17:01 last edited by
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?
-
Hi,
To disable horizontal scrolling on ScrollView, try this:
@
ScrollView {
Image { source: "15686.jpg" }
flickableItem.onContentXChanged: flickableItem.contentX = 0
}
@ -
wrote on 9 Dec 2014, 09:21 last edited by
That workaround will probably cause problems. I would suggest that you instead try:
@
ScrollView {
Image { source: "15686.jpg" }
flickableItem.flickableDirection: Flickable.VerticalFlick
}
@ -
wrote on 9 Dec 2014, 10:23 last edited by
Thanks, that solved my problem!
-
wrote on 9 Dec 2014, 10:58 last edited by
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
}
}
}@ -
+1 Jens for the exact solution.
1/6