google has introduced the DrawerLayout, which shows a menu on the left area of the screen when you click on the "up" button of the action bar.
because the library isn't supported yet on actionBarSherlock, there is already a way to overcome it using this project .
it already has variants on many apps: currents, gmail, hangouts, youtube...
on the "currents" app (and in youtube) , when the user slides the (most-left) page from left to right , the DrawerLayout appears, no matter where the finger has started the touch .
how can i achieve the same effect? maybe i should use onInterceptTouchEvent ?
there isn't much documentation and tutorials of what cool things can be done , other than this link (ok and this one too) . they say (in the part of "Give the user a quick peek") that about 20dp on the left is used for this functionality, but i can see that "currents" work with much larger area.
it seems the library is still not quite finished, and so the layout xml file cannot even be shown in the visual UI editor...
EDIT: it seems that the library is open sourced. code is available on :
.../android-sdk\sources\android-18\android\support\v4\widget\DrawerLayout.java
.../android-sdk\sources\android-18\android\support\v4\widget\SlidingPaneLayout.java
.../android-sdk\sources\android-18\android\support\v4\app\ActionBarDrawerToggle.java
now the question is how to make it work as i've written, so that it would work like on youtube , allowing us to customize how it looks and from where to allow scrolling it.
To use a DrawerLayout, position your primary content view as the first child with width and height of match_parent and no layout_gravity> . Add drawers as child views after the main content view and set the layout_gravity appropriately.
set DrawerLayout tools:openDrawer="end" set NavigationView android:layout_gravity="end" change tag view from androidx.
Sometimes, our app requires a common navigation drawer for all activities in the app. For implementing it, We can implement it by removing the same code from all activities and write it properly in our BaseActivity. 1. We have to add a navigation drawer and FrameLayout base_activity's XML.
SlidingMenu is best sliding library I've ever found, It's very good library.
You can set getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN)
enabling fling for all screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With