2013-08-05 71 views
2

美好的一天, 我想創建一個帶有ListView和更多視圖的導航抽屜。我可以將多個列表視圖添加到導航抽屜嗎?

我的問題是,當我嘗試點擊其他視圖點擊不註冊

能否請你告訴我,如果我可以創建一個複雜的視圖結構作爲導航抽屜?

<?xml version="1.0" encoding="utf-8"?> 
<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" > 

<!-- The main content view --> 

<FrameLayout 
    android:id="@+id/content_frame" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 
<!-- The navigation drawer --> 

<LinearLayout 
    android:id="@+id/left_drawer" 
    android:layout_width="240dp" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:background="@color/charcoal" 
    android:divider="@android:color/transparent" 
    android:dividerHeight="0dp" 
    android:orientation="vertical" 
    android:showDividers="middle" > 

    <ListView 
     android:id="@+id/home_drawer_lv_accounts" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:choiceMode="singleChoice" 
     android:divider="@color/amazon" 
     android:dividerHeight="5dp" > 
    </ListView> 

    <CheckedTextView 
     android:id="@+id/home_drawer_cv_banks" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/health" 
     android:focusable="true" 
     android:gravity="center" 
     android:text="@string/text_all_banks" 
     android:textAppearance="?android:attr/textAppearanceLarge" 
     android:textColor="#FFF" /> 
</LinearLayout> 

</android.support.v4.widget.DrawerLayout> 

回答

-1

修改烏爾XML如下

<LinearLayout 
    android:id="@+id/left_drawer" 
    android:layout_width="240dp" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:background="@color/charcoal" 
    android:divider="@android:color/transparent" 
    android:dividerHeight="0dp" 
    android:orientation="vertical" 
    android:showDividers="middle" > 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 

     <ListView 
      android:id="@+id/home_drawer_lv_accounts" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="@android:color/holo_red_light" 
      android:choiceMode="singleChoice" 
      android:divider="@android:color/black" 
      android:dividerHeight="5dp" > 
     </ListView> 

     <CheckedTextView 
      android:id="@+id/home_drawer_cv_banks" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true" 
      android:background="@android:color/holo_red_light" 
      android:focusable="true" 
      android:text="Some Dummy Text" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      android:textColor="#FFF" /> 
    </RelativeLayout> 
</LinearLayout>