【发布时间】:2016-07-30 13:19:51
【问题描述】:
我有自定义工具栏,我希望我的列表视图位于 Toolbar 下方。但是 listview 出现在工具栏上,而我的 layout_below 不起作用。我知道以前有人问过很多问题。但没有任何工作。请帮帮我
下面是我的layoutxml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="faisal.home.com.tafaqquhfiddin.DuwaListView">
<include
layout="@layout/toolbar_layout"
/>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/MyListView"
android:layout_below="@+id/toolbar"
></ListView>
</RelativeLayout>
工具栏布局.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/orange"
app:layout_scrollFlags="scroll|enterAlways"
app:titleTextColor="@color/white"></android.support.v7.widget.Toolbar>
</LinearLayout>
【问题讨论】:
-
问题是因为您在toolbarlayout.xml 上的线性布局占据了屏幕的所有高度,因为您将其指定为匹配父项
标签: android android-layout listview android-activity android-toolbar