如何更改抽屉标题?

我是 Android 新手,正在开发一个应用程序。我正在尝试开发一个具有抽屉布局的应用程序。一切都很好,但我无法更改屏幕截图上标记的抽屉菜单的标题。

http://img2.mukewang.com/61cd7a21000119bd07291295.jpg


一只甜甜圈
浏览 227回答 2
2回答

一只名叫tom的猫

您可以添加自定义标题布局。 https://developer.android.com/training/implementing-navigation/nav-drawer#HeaderLayout

拉莫斯之舞

更多定制如果您想为您的抽屉进行更多定制。您可以为 Drawer 创建一个布局并将其包含在android.support.design.widget.NavigationViewLike this 中</android.support.v4.widget.DrawerLayout>&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;...........&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<!- Drawer >&nbsp; &nbsp; &nbsp;<android.support.design.widget.NavigationView&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/nav_view"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="150dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="match_parent"&nbsp; &nbsp; &nbsp; &nbsp; android:fitsSystemWindows="true"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_gravity="left"&nbsp; &nbsp; &nbsp; &nbsp; >&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<!--- Your custom layout >&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <include layout="@layout/custom_drawer_layout"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/filterDrawer"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="match_parent"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="match_parent"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; android:layout_gravity="end"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/>&nbsp; &nbsp; </android.support.design.widget.NavigationView>&nbsp;</android.support.v4.widget.DrawerLayout>然后你可以创建一个布局 custom_drawer_layoutcustom_drawer_layout.xml<RelativeLayout>&nbsp; &nbsp; &nbsp;<spinner/>&nbsp; &nbsp; &nbsp;<button/>&nbsp; &nbsp; &nbsp;<whatever/></RelativeLayout>希望你能明白。你可以在这里看到一个相关的项目
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java