<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/PetPhoto_imageview"
        android:layout_width="200dp"
        android:layout_height="200dp"

        app:layout_constraintBottom_toTopOf="@+id/PetItem_textview"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_chainStyle="packed"
        app:srcCompat="@drawable/dog" />

    <TextView

        android:id="@+id/PetItem_textview"
        android:layout_width="199dp"
        android:layout_height="38dp"
        android:layout_alignBottom="@+id/PetPhoto_imageview"
        android:layout_alignParentStart="true"
        android:layout_marginStart="0dp"

        android:alpha="0.3"
        android:background="@color/black"
        android:gravity="bottom"
        android:textAlignment="center"
        android:textColor="@color/white"
        android:textSize="20sp"
        android:textStyle="bold"
        tools:text="100" />
</RelativeLayout>

</android.support.v7.widget.CardView>

Those are my layout files, then picture below was they look like now, I want to set those pictures in two columns.

推荐答案

If i understand correctly, you want to have the items in your recyclerview able to show in two columns. Try adding this when you set layoutManager

recyclerView.setLayoutManager(new GridLayoutManager(this, 2));

Kotlin相关问答推荐

外键是主键的一部分,但不是索引的一部分.房间

我可以在kotlin/java.util.scanner中跳过分隔符而不重复吗?

Kotlin:类型不匹配:推断的类型已运行,但应等待

Kotlin中反射中Int到可空Double的隐式转换失败

如何在 Kotlin 中初始化 Short 数组?

Kotlin 协程:flatMapLatest 什么都不发出

Webpack 配置未应用于 kotlin 多平台react 项目

为什么Kotlin不用static inner class来实现带有object关键字的单例呢?

Kotlin 启动与启动(Dispatchers.Default)

从带有 Room 和 Flows 的 SQLite 表中获取祖先树

Kotlin:内部类如何访问在外部类中声明为参数的变量?

如何修复 ViewPager2 中的Design assumption violated错误?

@uncheckedVariance 在 Kotlin 中?

如何将vararg转换为list?

如何在Kotlin中创建填充空值的通用数组?

Android 与 Kotlin - 如何使用 HttpUrlConnection

Kotlin Native如何将字节数组转换为字符串?

如何为kotlin异常生成SerialVersionId?

如何获取Kotlin中变量的名称?

内联 onFocusChange kotlin