Tony Tong
Tony Tong

Reputation: 365

how to make a sliding drawer not transparent?

on my mapview there is a sliding drawer. When the drawer is open, I can still touch and slide the map via it. I changed the background color of the drawer, but only the color is changed, it is still "transparent". Can someone teach how to "fix" it? thank you!

Upvotes: 0

Views: 509

Answers (4)

Amna Mirza
Amna Mirza

Reputation: 703

By giving background color to its contents

<SlidingDrawer xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer"
    android:layout_width="100dp"
    android:layout_height="fill_parent"
    android:content="@+id/content"
    android:handle="@+id/handle"
    android:orientation="horizontal" >

        <ListView
            android:id="@+id/navList"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:background="#000000"
            android:gravity="center_vertical" />
    </LinearLayout>

</SlidingDrawer>

Upvotes: 1

Gal Rom
Gal Rom

Reputation: 6461

you need to wrap the content of the sliding drawer with a LinearLayout with a background. here is an xml that will solve your problem :

<SlidingDrawer
    android:id="@+id/friends_list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentLeft="true"
    android:layout_centerVertical="true"
    android:orientation="vertical"
    android:content="@+id/content"
    android:handle="@+id/handle" 
    android:focusable="true"
    >

    <Button
        android:id="@+id/handle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/pull_me" />
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:id="@+id/content"
        android:background="#fff">
        <ListView
        android:id="@+id/friends_lv" 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
        </ListView>
   </LinearLayout>
</SlidingDrawer>

Upvotes: 0

Shivang Trivedi
Shivang Trivedi

Reputation: 2182

try this library for sliding drawer https://github.com/korovyansk/android-fb-like-slideout-navigation

Upvotes: 0

Andre
Andre

Reputation: 3181

I believe you should only need to make the drawer focusable in order for it to take taps from the map view in the background (even if those taps have no actions associated with them).

Upvotes: 0

Related Questions