簡體   English   中英

打開滑動抽屜時背景不活動

[英]Inactive background when slidingdrawer is open

我正在使用slidingdrawer,並且能夠在我的應用程序中的所有活動上顯示slidingdrawer。

我面臨的問題是我仍然能夠單擊背景(活動中的視圖)。 有沒有一種方法可以在打開slidedrawer時禁用背景。

問候

編輯1

<?xml version="1.0" encoding="utf-8"?>
<SlidingDrawer xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/slidingDrawer1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:content="@+id/content"
    android:handle="@+id/handle" >

    <Button
        android:id="@+id/handle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Handle" />

    <LinearLayout
        android:id="@+id/content"
        style="@style/roundrectbox_white_layout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/slider_round_rect_border"
        android:orientation="vertical"
        android:padding="15dp" >

        <ListView
            android:id="@+id/listView1"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:cacheColorHint="@android:color/transparent"
            android:divider="@android:color/transparent"
            android:listSelector="@android:color/transparent" />
    </LinearLayout>

</SlidingDrawer>

嘗試這個:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TextView
        android:id="@+id/text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:text="@string/hello"/>

    <SlidingDrawer
        android:id="@+id/drawer"
        android:layout_width="320dp"
        android:layout_height="440dp"
        android:content="@+id/content"
        android:handle="@+id/handle"
        android:orientation="vertical" >

        <Button
            android:id="@+id/handle"
            android:layout_width="fill_parent"
            android:layout_height="20dp"
            android:background="@drawable/wood" />

        <RelativeLayout
            android:id="@+id/content"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
             >

                <ListView 
                    android:id="@+id/list"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"></ListView>
        </RelativeLayout>
    </SlidingDrawer>

</RelativeLayout>

並在活動中:

ListView listView=(ListView) findViewById(R.id.list);
        ArrayAdapter<String>  adapter=new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1,array);
        listView.setAdapter(adapter);

數組在哪里:

String[] array={"1","2","3","4"};

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM