java - 如何让ListView定位到某个元素下?

标签 java android xml listview layout

我试图将 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/

相关文章:

java - 无法在 ubuntu 上启动 adt-bundle 来运行程序

java - parseInt 与 isDigit

javascript - 'beforeunload' 事件在 Android 上留在后台时触发

php - 解析简单的 XML - Javascript/Ajax

C# System.Xml.Serialization - 仅使用 <a></a> 而从不使用 <a/>

java - 使用Zk框架上传文件

java - 在 android 中禁用多选列表首选项中的复选框单击

android - 如何在后台在android设备上发送短信?

java - 让用户点击的地方出现一个按钮

java - 如何用java打印字符串从第一个字符到确定的字符?