For onTouch listener, the function is
public boolean onTouch( View v, MotionEvent event )
based on the tutorial I'm following, it stated that return true - we have already processed the event ; return false - View itself will process the event
I can't really understand this.
Event listener and event dispatching process
Started by
Guest_R3.RyozKidz_*
, Sep 28 2011 08:01 PM
1 reply to this topic
#1
Guest_R3.RyozKidz_*
Posted 28 September 2011 - 08:01 PM
Guest_R3.RyozKidz_*
|
|
|
#2
Posted 12 April 2012 - 05:50 AM
there is mainly 2 reasons :
there is Motionevents that you are not interested in but you still need to implement them cause the interface asks for it.
And then, in the program,
it happens that when you touch in a screen area sometimes you touch over many view's area, like this : you touch a button which is inside an imageView, which is inside TableRow, which is inside a TableLayout, which is inside a ScrollView and so on.
so the touch event will fire for all those elements, but you want to process the ontouch only for the button, or for the imageview, so the other elements needs to let that event pass so it gets to the true target.
there is Motionevents that you are not interested in but you still need to implement them cause the interface asks for it.
And then, in the program,
it happens that when you touch in a screen area sometimes you touch over many view's area, like this : you touch a button which is inside an imageView, which is inside TableRow, which is inside a TableLayout, which is inside a ScrollView and so on.
so the touch event will fire for all those elements, but you want to process the ontouch only for the button, or for the imageview, so the other elements needs to let that event pass so it gets to the true target.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top










