【发布时间】:2022-01-09 16:24:07
【问题描述】:
我是安卓新手。我在stackoverflow上搜索了很多关于如何设置recyclerview的所有图像的高度相同的内容。 stackoverflow 有很多这样的问题,但是他们的答案对于新手来说太复杂了。
这就是我的代码正在做的事情。 enter image description here
这就是我想要实现的。 enter image description here
我知道网格布局的第一张图片跨度是第二张图片中的 2 和 3,但这不是问题。我希望所有图像的高度相同。
这里是recyclerview的单行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:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/sub_imgview"
android:layout_width="match_parent"
android:layout_height="200dp"
android:fitsSystemWindows="true"
android:layout_margin="10dp"
tools:src="@drawable/editorchoice2"
app:layout_constraintTop_toTopOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
【问题讨论】:
标签: java android android-recyclerview imageview