Java 显示在工具栏下方的Android ListView
我正试图把一个列表视图放在一个有导航抽屉的工具栏下面。当前,ListView显示在工具栏下方,而不是工具栏下方。请参见图片。我该如何解决这个问题 activity_main.xml 谢谢 使用android:orientation=vertical属性将FrameLayout更改为线性布局 作为补充说明,您应该使用RecyclerView而不是ListViewJava 显示在工具栏下方的Android ListView,java,android,Java,Android,我正试图把一个列表视图放在一个有导航抽屉的工具栏下面。当前,ListView显示在工具栏下方,而不是工具栏下方。请参见图片。我该如何解决这个问题 activity_main.xml 谢谢 使用android:orientation=vertical属性将FrameLayout更改为线性布局 作为补充说明,您应该使用RecyclerView而不是ListView <?xml version="1.0" encoding="utf-8"?> <!-- Use DrawerLayou
<?xml version="1.0" encoding="utf-8"?>
<!-- Use DrawerLayout as root container for activity -->
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<!-- Layout to contain contents of main body of screen (drawer will slide over this) -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar" />
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"></ListView>
</FrameLayout>
<!-- Container for contents of drawer - use NavigationView to make configuration easier -->
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:menu="@menu/drawer_view"/>
</android.support.v4.widget.DrawerLayout>