Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Background colour of sliding drawer

I am currently working on an android project and making use of the SlidingDrawer but I am having a problem with changing the background colour.

By default the SlidingDrawer appears to be transparent so when it is slid up over the content it is hard to read the content of the slidingdrawer due to the main screen being shown underneath.

I wanted to change the background colour to black but for some reason this changes the background colour of the main content so you can't see any of the content and only the content of the sliding drawer when it is pushed up the screen.

Below is the code that I have used to generate the sliding drawer

<SlidingDrawer 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/drawer"
        android:handle="@+id/handle"
        android:content="@+id/content"
        android:background="@color/black">
        <ImageView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/handle"
            android:src="@drawable/ic_launcher"/>
        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical"
            android:id="@+id/content">
        <TextView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="I am a sliding drawer - Hello World"/>
        </LinearLayout>
    </SlidingDrawer>

Thanks for any help you can provide.

like image 601
Boardy Avatar asked Dec 30 '11 17:12

Boardy


1 Answers

Provide background to the LinearLayout having id of content like this:

<LinearLayout android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical"
            android:id="@+id/content"
            android:background="#000">
like image 51
Adil Soomro Avatar answered Sep 23 '22 14:09

Adil Soomro