Get rid of Android navigation drawer translucency

android, android-layout

Solution

You want to `setScrimColor` with zero alpha.

mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerLayout.setScrimColor(Color.parseColor("#00FFFFFF"));

where `R.id.drawer_layout` is the id of my `DrawerLayout`

Problem

In my app, I'm using the navigation drawer from the support library. It is translucent by default, and setting it or its childrens' background color just adds a translucent version of this color. This is the drawer and its two children: ``` <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" android:background="@color/black"> <FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" /> <ListView android:id="@+id/left_drawer_p" android:layout_width="500dp" android:layout_height="match_parent" android:layout_gravity="start" android:choiceMode="singleChoice" android:divider="@android:color/transparent" android:dividerHeight="0dp" android:background="@color/grey"/> </android.support.v4.widget.DrawerLayout> ```

Original source