【发布时间】:2016-05-18 22:36:33
【问题描述】:
如何创建像 Google+ 这样的导航抽屉,其中有用户个人资料信息的标题和下面的 listview?
我的 Activity 中有以下代码:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.br.app.MainActivity">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<fragment android:id="@+id/navigation_drawer"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:name="com.br.app.NavigationDrawerFragment" />
</android.support.v4.widget.DrawerLayout>
目前,NavigationDrawerFragment 仅包含一个列表视图,但我尝试添加一个 RelativeLayout 作为具有内部 RelativeLayout 的容器来创建配置文件区域和下面的列表视图,但应用程序崩溃了。
我已经阅读了教程from,但据我所知,我的标题将是listview 的一个项目,它不会固定在顶部(不滚动)。
如何像 Google+ 一样创建自定义导航抽屉?
【问题讨论】: