Android 如何在NavigationView中添加其他布局
我正在尝试在NavigationView中添加Expandlistview,但失败。 我可以在标题下添加布局吗 活动单元主布局图Android 如何在NavigationView中添加其他布局,android,android-support-library,android-design-library,navigationview,Android,Android Support Library,Android Design Library,Navigationview,我正在尝试在NavigationView中添加Expandlistview,但失败。 我可以在标题下添加布局吗 活动单元主布局图 您可以在导航抽屉列表中使用listview,并将标题视图附加到包含可展开listview的列表中。我不确定,但您可以检查一下。我的解决方案是。。如果您使用具有特定高度的标题布局,对于ex 200dp。。然后在activity_main.xml中,为可扩展的listview标记包含210dp的页边空白顶部0f。。我希望您没有使用导航视图的菜单 <android
您可以在导航抽屉列表中使用listview,并将标题视图附加到包含可展开listview的列表中。我不确定,但您可以检查一下。我的解决方案是。。如果您使用具有特定高度的标题布局,对于ex 200dp。。然后在activity_main.xml中,为可扩展的listview标记包含210dp的页边空白顶部0f。。我希望您没有使用导航视图的菜单
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/header">
<ExpandableListView
android:id="@+id/expanded_menu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="210dp" />
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
让我看看您的整个活动或设置drawer@Sree我想添加类似标题的metrial设计您可以有一个解决方案,即对标题布局的根元素应用固定宽度,并为您的ExpandableListView
提供相同大小的marginTop
。不要使用NavigationView获取它
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/header">
<ExpandableListView
android:id="@+id/expanded_menu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="210dp" />
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>