I am implementing a custom expandable action bar in my game.
I am using ViewDragHelper to handle the dragging and flinging of the bar view, which is contained in a LinearLayout
I subclassed to attach the ViewDragHelper.
The following links have been of great help to achieve this:
- Tutorial on the ViewDragHelper: http://flavienlaurent.com/blog/2013/08/28/each-navigation-drawer-hides-a-viewdraghelper/
- Mastering the Android touch system: https://www.youtube.com/watch?v=EZAoJU-nUyI (which has given me they key to make Views clickable and draggable)
The only issue I am encountering is the behavior of the layout() of my parent LinearLayout: on every call to layout()
/ onLayout()
, the child draggable/expandable action bar is reset to its original position (the one set in the XML layout).
Why is that ?
(In my experience layout()
never messes with the positions of views that have already been moved)
requestLayout()
on the parent layout of this project: github.com/flavienlaurent/flavienlaurent.com/tree/master/… – Rubberize