Answer the question
In order to leave comments, you need to log in
How to open the Navigation Drawer with a swipe from the middle of the screen?
I use the standard Navigation Drawer in the android application.
Does it have the ability to open with a swipe from the middle of the screen and not from the edge.
For example, how the VKontakte application is made.
Figure for clarity:
Answer the question
In order to leave comments, you need to log in
In VK, you could do this when they did not use the Navigation Drawer, but used a self-made slide panel. As far as I know, there is no such functionality in the Navigation Drawer itself. From experience I can say that this is not worth doing and in the future you will only rake.
But if you really want to, then
1. Do gesture detection and finger movement on the content (onTouch and SimpleGustureListener)
2. use self-made solutions like https://github.com/jfeinstein10/SlidingMenu
yes, the distance is strictly prescribed in the classes themselves.
you can, in theory, do it through reflections,
SO for
example, such a solution gives
DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
Field mDragger = mDrawerLayout.getClass().getDeclaredField(
"mLeftDragger");//mRightDragger for right obviously
mDragger.setAccessible(true);
ViewDragHelper draggerObj = (ViewDragHelper) mDragger
.get(mDrawerLayout);
Field mEdgeSize = draggerObj.getClass().getDeclaredField(
"mEdgeSize");
mEdgeSize.setAccessible(true);
int edge = mEdgeSize.getInt(draggerObj);
mEdgeSize.setInt(draggerObj, edge * 5); // вот тут меняем размер.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question