I would like to create a sidebar like the one in dolphin browser or firefox for android.
I have a listview that is my main screen, when I swype to right I wish to move the listview to right and make appear a new view on the left.
PS : I'm a french guy sorry for the english :-)
preguntado el 08 de enero de 11 a las 20:01
Echa un vistazo a la
Workspace widget in the Android Open Source Project Launcher2 code. This is the widget that implements the side to side paging behavior on the stock Android home screen.
The basic idea is to create a custom widget that can pan its contents with rules for snapping to a final position if the user flings or lets go. Use
onInterceptTouchEvent to determine when the user has crossed a 'slop' threshold in horizontal motion (you can get the system values for this from
ViewConfiguration) and steal away input focus from any child views in the hierarchy. From there, control the panning in
onTouchEvent. Puedes usar un
VelocityTracker to determine how the content should fling when the user lets go and a
Scroller to help you animate to the final position.
You can make the pane with LinearLayout with a width at 0, then you can use also GestureBuilder to detect horizontal swipe and Animation to change progressively the widthof your LinearLayout to the desired width.