-
Notifications
You must be signed in to change notification settings - Fork 147
Touch events not being intercepted when in DrawerLayout #38
Comments
I have someone else having that problem, so I would like to test it and see if there is a workaround. Problem is, I know I won't have much time for it during the next weeks, since there is still laying several other work around here. Also think, if you really want to have a swiping layout in your navigation drawer. In most cases (not necessarily all) this will create bad usability, since you are nesting containers which scroll in the same direction into each other. As you said, you only want to handle the outer container the right to left and the inner container the left to right swipe, but the question is: do your users instantly know that. If they don't see your UI and know how to interact with it, you hide functionality and created a bad usability for them. Though I don't deny there are rare cases where it makes sense. PS: This is not a lame excuse, so I don't need to fix that, I swear I will look into it, when I find time, but somehow this spring is filled with conferences and such. |
Yes, but I think this has nothing to do with my issue; it's supposed to solve the problem when children views are catching the events, not parent views (ie. drawer layout in my case). I am thinking that if there was a getParent().requestDisallowInterceptTouchEvent(true) somewhere in the onTouchEvent code (eg. after we make sure the ListView should handle the event), it might work. PS. I just got your reply through ajax while writing this and I see what you mean about usability; I have already implemented list item removal through a popupmenu, the swipe functionality will be a bonus eye-candy :-) |
OK, I did some digging, and (at least for my case) the solution is a one-liner: getParent().requestDisallowInterceptTouchEvent(true); right after if(isSwipeDirectionValid(deltaX)) { in onTouchEvent method gives the desired result; and I think it actually makes sense, since it means "I will handle the event, parents should leave it alone". If you would be so kind to take a look at it (and hopefully merge it), I would be really grateful (and it would save me the trouble of importing the project source as a library, etc). |
Sounds like a good solution and seem to work right now. I hope this won't break some cases where the parent needs to intercept the children even in that cases (that I might not have thought about). Will be pushing it soon. |
Released with v0.3.2. Should be synced in maven central in some hours. |
it is a problem if used with PullToRefresh: https://github.com/chrisbanes/ActionBar-PullToRefresh |
Hi, I am trying to use this library inside my right drawer in Android Support DrawerLayout, but the drawer seems to be capturing the touch events, so swiping does not work.
Ideally, I would like the drawer to handle the left-to-write swipe (so that it can close by swiping; it's the right drawer) and the ExtendedListView to handle the right-to-left swipe, so that I can have swipe to delete working.
After fiddling around, I can only either get the ListView or the drawer to handle both swipes.
Any help would be appreciated...
The text was updated successfully, but these errors were encountered: