我试图将 ListView 放在工具栏下,但第一个项目正在工具栏中设置,你能帮我吗?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_blue_bright">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/cardview_light_background"
android:minHeight="?attr/actionBarSize"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="invites_fragment"
android:textSize="30sp"
android:layout_centerInParent="true">
</TextView>
</androidx.appcompat.widget.Toolbar>
<ListView
android:id="@+id/chatList"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
最佳答案
只需在ListView
中添加属性
android:layout_below="@+id/toolbar"
关于java - 如何让ListView定位到某个元素下?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62048840/