简体   繁体   中英

custom layout in navigation drawer

I am new to android, I follow this tutorial to create Navigation Drawer here

I make the navigation drawer successfully but I dont know how to change framelayout to my custom layout with button, textview....My app just show menu and blank framelayout, how can I solve this ?

<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,并且可以在其中构建整个布局

If you need to add another layout you need to gie it to your closeDrawer and drawerOpen .

Please refer my answer here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM