I am using the following xml file in the navigation box
XML:
<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"
android:orientation="vertical"
>
</FrameLayout>
<RelativeLayout
android:layout_width="240dp"
android:layout_height="fill_parent"
android:layout_gravity="start"
android:id="@+id/drawer_frame"
android:background="@drawable/list_selector"
>
<LinearLayout
android:id="@+id/header"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:background="@drawable/list_selector"
android:clickable="true"
android:onClick="Login"
>
<ImageView
android:id="@+id/DisplayImage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="5dp"
android:src="@drawable/displayimage"
android:contentDescription="@string/contentdescription"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="vertical" >
<TextView
android:id="@+id/Displayname"
android:layout_marginLeft="3dp"
android:layout_marginTop="5dp"
android:layout_marginRight="3dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/counter_text_color"
android:textSize="14sp"
android:text="@string/Signin"
android:gravity = "center"
/>
</LinearLayout>
</LinearLayout>
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@color/card_background"
android:dividerHeight="1dp"
android:background="@drawable/list_selector"
android:layout_marginTop="5dp"
android:layout_below="@+id/view1"
/>
<include android:id="@+id/progressinformation" layout="@layout/emptyview"/>
<View
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_alignParentLeft="true"
android:layout_below="@+id/header"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:background="@color/card_background"
/>
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
I set include as an empty view for left_drawer (left_drawer.setEmptyView (R.id.progressinformation information)).
My problem: suppose that if listview is empty, when I click on the navigation drawer, the elements behind the navigation drawer are selected. how to avoid this choice when listview is empty.
source
share