(I've seen a few related questions but no answers so putting this out on the odd chance someone has done something similar or can point me in the right direction...)
The standard Android SlidingDrawer (and also Alessandro Crugnola's multi-direction variant which I'm using) centre-aligns the handle. Has anyone implemented a SlidingDrawer which offers the option to right or left align the handle?.. or anyone have any tips on how to go about this?
Assuming you are using default (vertical) orientation: If you want to move the drawer handle to the left, set the android:layout_marginRight value of the sliding drawer to some positive number. Do the opposite android:layout_marginLeft if you want the handle to move to the right. There is no align right/left per se with the sliding drawer. If you want a more dynamic alignment, you will have to use layouts to get the desired affect.
Worked it out. In the
mVertical
is true condition of theonLayout(boolean changed, int l, int t, int r, int b)
method of SlidingDrawer (or whatever variant of SlidingDrawer you're using), you should find the following line of code...... which centre-aligns the handle. Change this to...
... to left-align the handle when the sliding drawer is set to slide vertical (i.e. bottom-to-top or top-to-bottom), or change it to...
... to right-align the handle.
Likewise, if the sliding drawer is set to slide horizontal (i.e. right-to-left or right-to-left), in the
mVertical
is false condition of theonLayout(boolean changed, int l, int t, int r, int b)
method, find the following line of code...... and change it to...
... to top-align the handle, or...
... to bottom-align the handle. Happy coding!