Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android NavigationDrawer transparency

I’ve implemented NavigationDrawer with android-support-v4 as per this tutorial

My result is on this screenshot.

The question is how to remove or configure these transparency on Drawer which looks awful with background text.

enter image description here

UPDATE: here is my layout configuration, with background been set to dark

<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"
        >

    <FrameLayout
            android:id="@+id/content_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

    <ListView
            android:id="@+id/left_drawer"
            android:layout_width="240dp"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:choiceMode="singleChoice"
            android:divider="@android:color/transparent"
            android:dividerHeight="0dp"
            android:background="#111111"/>
</android.support.v4.widget.DrawerLayout>
like image 964
Sergii Avatar asked Dec 20 '13 13:12

Sergii


People also ask

How to make navigation drawer transparent in Android?

navigationView. getBackground(). setAlpha(122); Here you can set the opacity between 0 (fully transparent) to 255 (completely opaque).


1 Answers

You need to add alpha to your ListView. Use your XML and extend the ListView definition with alpha-attribute.

<ListView
     android:id="@+id/left_drawer"
     android:layout_width="240dp"
     android:layout_height="match_parent"
     android:layout_gravity="start"
     android:choiceMode="singleChoice"
     android:divider="@android:color/transparent"
     android:dividerHeight="0dp"
     android:background="#111111"
     android:alpha="255"
/>
like image 136
drdrej Avatar answered Sep 24 '22 09:09

drdrej