3
내가 탐색 서랍에 다음과 같은 XML 파일을 사용하고메인 콘텐트는 탐색 서랍 프레임에서 액세스 할 수 있습니다.
는 XML :
<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
<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">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
</FrameLayout>
<!-- android:layout_gravity="start" tells DrawerLayout to treat
this as a sliding drawer on the left side for left-to-right
languages and on the right side for right-to-left languages.
The drawer is given a fixed width in dp and extends the full height of
the container. A solid background is used for contrast
with the content view. -->
<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>
내가 설정하고 는 (left_drawer.setEmptyView (R.id left_drawer 에 대한 빈보기로 있습니다. 진보 정보)).
제 문제는 탐색 서랍을 클릭했을 때 listview가 비어있는 경우 탐색 서랍 뒤에있는 요소가 선택되어 있다고 가정합니다. listview가 비어있을 때이 선택을 피하는 방법.