Question

i have GridView with each Grid as a simple TextView. i need a scrollbar for the TextView inside each Grid in the GridView. but encorporating a scrollbar disables my onClickListener for my gridview. i tried a using a ScrollView encapsulating a TextView and also using the built in scroll-bar of textview. either way i lose getting onClick events for my GridView. i have heard about problem of using childviews that can be clicked or focused inside an adapterview and getting the onclick listener disabled. if have tried to set the Scrollview property of clickable and focusable to false and yet couldnt able to solve the problem.

i want a feature such that when the grid is clicked the onClick event registered for GridView be invoked and when a gird is dragged (preferrably in vertical direction) the textview must scroll.

Thanks in advance

Was it helpful?

Solution

A slight modification to your idea can make it implementable.
Initially keep all textviews scrolls disabled. When a tap occurs on it (this will be gridview's onItemClick) enable the scrollable state of the textview and set the onclicklistener for it. Now it can be scrolled as well as clicked. You got to maintain a member reference to current scrollable texview. When tap occurs on a different item set the current items textview unclickable and set the tapped item as currrent scrollable with click listener to it.
The gridview can still be scrolled by dragging on any area apart from the current scrollable textview.
Just a suggestion if you can use it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top