Android ConstraintLayout RecyclerView中的不同高度

Android ConstraintLayout RecyclerView中的不同高度,android,android-layout,kotlin,android-recyclerview,Android,Android Layout,Kotlin,Android Recyclerview,我有这个结构 RecyclerView - ConstraintLayout - - CardView - - - ConstraintLayout - - - - ImageView - - - - TextView - - - - TextView 代码: 如果我有两个或两个以上的项目宽度不同的高度,有一列中的空白 如何删除它并制作类似于图片中的内容 您的文本视图似乎具有换行内容高度,这就是其中一个更大的原因。签出此答案以获得您要查找的结果您的文本视图似乎具有换行内容高度,

我有这个结构

RecyclerView
 - ConstraintLayout
 - - CardView
 - - - ConstraintLayout
 - - - - ImageView 
 - - - - TextView
 - - - - TextView
代码:

如果我有两个或两个以上的项目宽度不同的高度,有一列中的空白

如何删除它并制作类似于图片中的内容


您的文本视图似乎具有换行内容高度,这就是其中一个更大的原因。签出此答案以获得您要查找的结果

您的文本视图似乎具有换行内容高度,这就是其中一个更大的原因。签出此答案以获得您要查找的结果

    vm = ViewModelProvider(this)[CatalogViewModel::class.java]
    vm.getList().observe(this, Observer {
        dataView = findViewById(R.id.dataList)
        adapter = CatalogRecycleViewAdapter(this, it.data.data)

        dataView.layoutManager = GridLayoutManager(this, 2, GridLayoutManager.VERTICAL, false);
        dataView.adapter = adapter;
    })