android - Android 垂直 RecyclerView 在 ConstraintLayout 内的高度变为 0;
问题描述
在 android studio 的预览中,应用程序很好,但在运行时高度变为零;这是布局的xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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/filemaneger_id"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f6f6f6"
android:focusable="true"
android:layoutDirection="ltr">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycv"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#ffffff"
android:scrollbars="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
顺便说一下,该应用程序在相对布局中运行良好;
解决方案
推荐阅读
- c# - 帮我修复我的代码无法将其从 java 转换为 c#
- c# - 如何使用匿名类型进行分组
- python-3.x - 如何从两个字符串中生成最短的字符串
- mysql - 如何修复 SSIS 中的 ODBC Driver 8.0 SQL 语法错误?
- python - 如何从网络链接收集数据和下载文件
- php - 类型:ParseError 消息:语法错误,意外的 '?>'
- for-loop - 在第一个间隔之前优雅地运行 Ticker 的身体?
- python - Pandas 从 Int64Index 转换为 RangeIndex
- javascript - 反应式 vuejs 数组不使用 v-for 显示其内容
- javascript - 删除数组上的相邻重复项