(deleted old thread due to a typo, why can't users edit their posts on these forums???)
Hi,
I am having big problems making Scrollview work on a Sony LT26i running Android 4.1.2. It works on all other devices I have tested so far - although it might be more devices are having the issue.
The issue is that a user click on a button nested within a Scrollview does not trigger the button's on_press, but triggers the scrollview's on_scroll_move instead. I do not know why this problem seems specific to the device. Clicking buttons outside the scrollview works fine.
I have found topics about this issue but they´re all very old. I am attaching a minimal example of the code I am using (ignore the module list)
from
kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.scrollview import ScrollView
Builder.load_string('''
<MainScreen>:
ScreenManager:
id: _screen_manager
Screen:
name: 'Browser'
ScrollView:
on_scroll_move: root.scrollMove()
GridLayout:
id: _browserFolders
cols: 1
size_hint_y: None
do_scroll_x: False
''')
class MainScreen(BoxLayout):
def __init__(self, **kwargs):
super(MainScreen, self).__init__(**kwargs)
for i in range (0,30):
folderButton = Button(text=str(i), size_hint_y = None, height = 150)
folderButton.bind(on_press=self.selectFolder)
self.ids._browserFolders.add_widget(folderButton)
self.ids._browserFolders.bind(minimum_height=self.ids._browserFolders.setter('height'))
def selectFolder(self,button):
print ("trace button pressed",button.text)
def scrollMove(self,*args):
print ("trace scroll move")
class TestApp(App):
def build(self):
return MainScreen()
if __name__ == "__main__":
TestApp().run()
When running the App I am getting the trace using Android Studio. the vast majority of the single clicks are calling the scrollMove function.
The issue exists regardless if I use the Kivy Launcher or if I install from an APK.
Any idea what to do with this? Thanks...