Get rid of the transparency of the Android navigation box

In my application, I use the navigation box from the support library. By default, it is translucent, and setting it or its background color for children simply adds a translucent version of that color. This is a box and his 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> 
+8
android android-layout
source share
2 answers

You want 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

+12
source share

I really don't understand your question, but if you try to make the navigation box transparent, use the following code:

 android:background="#60FFFFFF" 

If "60" is about 38% transparency (60 in hexadecimal is 96 in decimal, so 96/255%).

But if your navigation box is already transparent, I used the code:

 android:background="#FFFFFF" 

It works great and is not transparent.

Both colors are the HTML color code for white, a simple Google search will find the code for other colors for you.

+4
source share

All Articles