Did you add clickable=true to your View?
On 4 Лис, 23:17, Bret Foreman bret.fore...@gmail.com wrote:
These views are inside an ExpandableListView, which is known to have a
number of bugs around text selection. This is just another in a list
of issues with that widget. I need to pass the event
So I set an onClickListener for the view and got the correct behavior.
I do the highlight background in the onTouchEvent and then remove the
background in the onClickListener. It's not pretty, but I don't see
any other way, since ACTION_UP never seems to occur.
However, this creates another
It's unfortunate that onClick and onTouch do not use the same
approach, where the method returns a true if it handled the event and
the parent shouldn't get the event a false if the parent should get
the event.
--
You received this message because you are subscribed to the Google
Groups Android
Well, if the docs say it clearly, its fine I guess.
On 04-Nov-2010 11:38 PM, Bret Foreman bret.fore...@gmail.com wrote:
It's unfortunate that onClick and onTouch do not use the same
approach, where the method returns a true if it handled the event and
the parent shouldn't get the event a false
True, except the inconsistency results in an incompleteness. The
onClick documentation doesn't state what mechanism has been created in
the onClick case to produce the same effect as returning a false in
the onTouch case.
On Nov 4, 11:10 am, Kumar Bibek coomar@gmail.com wrote:
Well, if the
It occurs to me that this may be a consequence of the _kind_ of view
I'm using. In this case, it's a TextView. I notice that the only
onTouch event that the default TextView passes to my onTouch method is
ACTION_DOWN. I'm guessing I need to set some flags elsewhere to get
other events for this
Scanning through the TextView docs did not reveal any flags that I
think would effect whether or not the ACTION_UP event was passed to
onTouch.
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to
Now here's an AMAZING thing. When I change onTouch to return true
(indicating that the event is handled) then the ACTION_UP event _is_
passed to onTouch. So returning false as a result of the ACTION_DOWN
somehow tells the stack to pass the subsequent ACTION_UP to onTouch.
This is not a fix,
It looks like the only workaround is brute force. I can extend
TextView to add a myParentView variable and then call the
myParentView.onTouchEvent. Of course I'll also return true from
onTouch so that I will successfully receive the ACTION_UP event. But
what a hack!
--
You received this message
OK, just for the reference of others, there's the fix, which works.
Returning true means the subsequent ACTION_UP is received. calling the
onTouchEvent method of the parent ensures that the event gets passed
up the stack. Of course, there's another method to set myParent.
04.11.2010 23:01, Bret Foreman ?:
Of course, there's another method to set myParent.
Could be like this:
arg0.getParent()
Or (assuming the listener is an inner class)
getParent()
--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
You
Ah, good point.That makes the hack a little simpler. It's still an
ugly hack.
On Nov 4, 1:09 pm, Kostya Vasilyev kmans...@gmail.com wrote:
04.11.2010 23:01, Bret Foreman ?:
Of course, there's another method to set myParent.
Could be like this:
arg0.getParent()
Or (assuming the
I don't know why you had a problem with this in the first place. I
have custom views where I override the OnTouch and I get ACTION_DOWN
and ACTION_UP messages just fine.
Also, why do you want to pass the message to the parent anyway? I
don't see a need for this.
-niko
On Nov 4, 3:23 pm, Bret
These views are inside an ExpandableListView, which is known to have a
number of bugs around text selection. This is just another in a list
of issues with that widget. I need to pass the event up the stack
because it also expands/collapses the rows in the ListView. Somebody
should really rewrite
14 matches
Mail list logo