Android Question Spinner over ScrollView

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi. I am forced to describe my problem by words. I cannot post the code and maybe preparing a test project is too long story.
I have an App displaying a ScrollView. Then, in some cases, I have to display a Spinner, which appears over the ScrollView. The Spinner is smaller than the ScrollView, so it is possible to touch the screen over the ScrollView, while the Spinner is visible, and waiting for user selection. If this happens, the spinner disappears, just like the first element was selected (and, btw, not the actually spinner element selected). I would like the spinner not to close without an actual user choice. Hope to have explained. Thanks in advance.
 

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi. Thanks. I have a ListView with a Spinner over it. Shall I put a panel over the ListView and the Spinner over the panel?
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi. I guess that I didn't explain well, so I attach a screen shot showing what happes. The problem is relative to the fact that the spinner list appears over the ScrollView.
 

Attachments

  • problem.png
    problem.png
    30.6 KB · Views: 187
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
The spinner is on the top, ouside the ScrollView, but, it opens over the ScrollView. Putting a panel over all the screen is clearly a radical solution. I must hide all the other views, because they are active and ripristinate them after user choice.. not so comfortable. Something that should be needed is to block the ScrollView to receive the touch. In Windows, all controls are Modal, and all my problems come from this basic difference.. Anyway, thanks. I will try something based on your ideas..
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
I must hide all the other views, because they are active and ripristinate them
Your other controls will not be "hidden", and you will not have to reinstate anything. @AnandGupta explained how to do this in post #2, but maybe you did not understand it, or maybe I do not understand what you are trying to achieve.

When you want to open the spinner you first put a transparent panel ("pnlDummy", say) over the entire screen. It is transparent so nothing is hidden. You create a touch handler for the panel as follows ...
B4X:
Sub pnlDummy_Touch (Action As Int, X As Float, Y As Float) As Boolean
    Return True
End Sub

Now the panel will intercept any touches on the screen and prevent them from reaching the scrollview (and any other underlying views). Then you add your spinner to pnlDummy. When you have finished with the scrollview remove it and pnlDummy. In effect you have created a "spinner dialogue".
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Instead of using a spinner, you can try a label or button instead. Upon clicking it, you can open an InputListASync dialog containing your spinner's items and proceed from there.
 
Upvote 0
Top