DrawerLayout getting stuck on swipe

Note that you can get around this 20dp peek feature by setting the clickable attribute to true on the FrameLayout within the DrawerLayout. android:clickable=”true” for instance : http://developer.android.com/training/implementing-navigation/nav-drawer.html <android.support.v4.widget.DrawerLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/drawer_layout” android:layout_width=”match_parent” android:layout_height=”match_parent”> <!– The main content view –> <FrameLayout android:id=”@+id/content_frame” android:layout_width=”match_parent” android:layout_height=”match_parent” android:clickable=”true” /> <!– The navigation drawer –> <ListView android:id=”@+id/left_drawer” android:layout_width=”240dp” android:layout_height=”match_parent” android:layout_gravity=”start” … Read more

push activity on the right when open drawer

Although there is no default way to slide the activity along with navigation drawer we can do it through code. As suggested in the above answer by mick88 following is the code snippet from my project. my profile.xml file <android.support.v4.widget.DrawerLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:facebook=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” android:id=”@+id/drawer_layout” android:layout_width=”match_parent” android:layout_height=”match_parent” > <!– Framelayout to display Fragments –> <RelativeLayout android:id=”@+id/mainView” … Read more

DrawerLayout must be measured with MeasureSpec.EXACTLY error

My DrawerLayout was inside a LinearLayout: <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:orientation=”vertical” android:background=”@drawable/abohawawallpapersqr” tools:context=”.MainActivity”> <include layout=”@layout/toolbar” /> <android.support.v4.widget.DrawerLayout android:id=”@+id/drawerLayout” android:layout_width=”match_parent” android:layout_height=”match_parent”> <!– …… –> </android.support.v4.widget.DrawerLayout> </LinearLayout> Then I solved the problem by changing the layout_height=”wrap_content” to layout_height=”match_parent” of LinearLayout.So the code is: <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” android:background=”@drawable/abohawawallpapersqr” tools:context=”.MainActivity”>

Changing Navigation drawer icon on action bar android

To replace the drawer indicator icon with your own drawable(non animated) using the v7 ActionBarDrawerToggle, you can do the following: //After instantiating your ActionBarDrawerToggle mDrawerToggle.setDrawerIndicatorEnabled(false); Drawable drawable = ResourcesCompat.getDrawable(getResources(), R.drawable.your_custom_icon, getActivity().getTheme()); mDrawerToggle.setHomeAsUpIndicator(drawable); mDrawerToggle.setToolbarNavigationClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mDrawerLayout.isDrawerVisible(GravityCompat.START)) { mDrawerLayout.closeDrawer(GravityCompat.START); } else { mDrawerLayout.openDrawer(GravityCompat.START); } } });

How to replace the hamburger icon used for ActionBarToggle on Android Toolbar with a custom drawable?

You can use the toolbar as Stand Alone mode, that means you should not use your toolbar as part of your ActionBarDrawerToggle constructor, you can achieve that using the below code: mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, null, R.drawable.appbar, R.drawable.appbar) (Note how the toolbar instance is not being sent to the ActionBarDrawerToggle constructor) Also, you should … Read more

ClassCastException android.widget.FrameLayout$LayoutParams to android.support.v4.widget.DrawerLayout$LayoutParams

What solved this issue for me: In MainActivity, add a new field for the LinearLayout, and assign value to it in onCreate() (this part just like emaleavil suggested): private LinearLayout linearLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // … linearLayout = (LinearLayout) findViewById(R.id.linearLayout); } Then in selectItem(), when calling closeDrawer(), simply pass linearLayout as … Read more

How to programmatically add a submenu item to the new material design android support library

[Update 20-03-2016] Bug is resolved. So no need to worry. [This below contetnt is outdated.] Adding a dynamic menu to NavigationView is currently bug on Design Support library. And I have report it to android bug source tracking. So wait till the bug will fixed. But if you want the temporary solution you can do … Read more

Android on Drawer Closed Listener

When you setup the ActionBarDrawerToggle you can “implement” the onDrawerClosed and onDrawerOpened callbacks. See the following example from the Docs: mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { super.onDrawerClosed(view); // Do whatever you want here } … Read more

Full width Navigation Drawer

If you want simpler solution you can just set negative margin android:layout_marginLeft=”-64dp” for your left_drawer: <include android:id=”@+id/left_drawer” android:orientation=”vertical” android:layout_width=”match_parent” android:layout_height=”match_parent” android:layout_gravity=”start” layout=”@layout/drawer” android:layout_marginLeft=”-64dp”/>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)