Navigation Drawer |
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
// On drawerLayout click open and close
public void openDrawable() {
// TODO Auto-generated method stub
optionMenuStr="open";
//menuImage.setBackgroundResource(R.drawable.backk);
drawerLayout.openDrawer(Gravity.LEFT);
}
public void closeDrawable() {
// TODO Auto-generated method stub
optionMenuStr="close";
menuImage.setBackgroundResource(R.drawable.menu);
drawerLayout.closeDrawers();
}
Disable Swipe Open Navigation Drawer Android:
Disable Swipe Open Navigation Drawer, sometime we use fragment and BaseActivity is same and fragment are different then in other fragments we need to stop swipe open Drawer then use this code.
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
Disable to Able Swipe Open Navigation Drawer Android:
if one you have disable swipe open then again it need to open else it not working.
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
XML Design.
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/content_frame_Home"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<RelativeLayout
android:id="@+id/left_relative"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="start" >
<include layout="@layout/slider" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
No comments :
Post a Comment