簡體   English   中英

導航抽屜中的自定義布局

[英]custom layout in navigation drawer

我是android新手,請按照本教程在此處創建導航抽屜

我成功制作了導航抽屜,但是我不知道如何使用按鈕textview將framelayout更改為自定義布局。...我的應用僅顯示菜單和空白framelayout,如何解決此問題?

<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:text="asdsadsad" />

    <ListView
       android:id="@+id/left_drawer"
       android:layout_width="240dp"
       android:layout_height="match_parent"
       android:layout_gravity="start"
       android:background="@color/purple_dark"
       android:choiceMode="singleChoice"
       android:divider="@android:color/darker_gray"
       android:dividerHeight="0.1dp" 
       android:listSelector="@drawable/ic_drawer"/>

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

您可以在LinearLayout上使用RelativeLayout而不是FrameLayout,並且可以在其中構建整個布局

如果需要添加其他布局,則需要將其添加到closeDrawerdrawerOpen

在這里參考我的答案

暫無
暫無

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

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