-1
由于我为导航抽屉使用了固定菜单,因此我尝试在DrawerLayout的第二个子代中使用LinearLayout,而不是RecyclerView/ListView,以使代码更易于使用。但结果是全屏幕线性布局。有什么方法可以在DrawerLayout中使用常规视图(如linearlayout)?在DrawerLayout中使用LinearLayout而不是RecyclerView
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello world"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bye world"/>
</LinearLayout>
向我们展示您的代码! –
“在DrawerLayout中有没有任何方法可以使用常规视图(如linearlayout)?” - 是的。您必须正确设置您的'DrawerLayout'及其子'View'。 –
如何设置DrawerLayout以使用LinearLayout而不是RecyclerView? –