Android Question Touch events and scope

mearleybrook

Member
Licensed User
Longtime User
Could somebody tell me if I am correct in reading that the touch event is only active for activity and panels? For the activity mode I can not find what the scope is. Does it only trigger when the activity background is touched? I was hoping that touching a label placed on a panel could be detected so as to move it with the move case.
 

klaus

Expert
Licensed User
Longtime User
If you have a Panel and on the Panel a Label and if you don't define any event for the Panel nor for the Label you can use Activity_Touch event.
If a view has no event rotuine the events are passed to it's parent view.

But you can also add Touch events for other views than Activity and Panel with the Reflection library with SetOnTouchListener.
 
Upvote 0

mearleybrook

Member
Licensed User
Longtime User
Thanks Klaus. I had , as you said , a label on a panel , but the label had a click event. I had sort of hoped that if I disabled that label (when it was clicked) then the later event of it being touched would pass thorough. but no. I wiil need to dig into reflections. Thanks for your time.
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
The Gesture Detector library allows you to let the event pass through (just return False for the touch event of the label).
 
Upvote 0

mearleybrook

Member
Licensed User
Longtime User
Great library - thanks. Not a serious user but it made my little task ( small app I am trying to write for granddaughter) slick and easy. Have a beer on me!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…