[英]Android RecyclerView item dynamic layout
您需要在主 Recyclerview 中添加水平 Recyclerview。 您的第一個 RecyclerView 是 Verticle 列表,並且在每個索引中創建另一個 RecyclerView 它是一個水平的。 所以你可以顯示n個Imageview。
您必須在主 Recyclerview 的子布局中創建 Recyclerview
就像是
假設這是主要的 Recyclerview
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/mainRecyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:listitem="@layout/item_demo" />
在您的子布局中,假設item_demo
您必須為要水平顯示的 imageView 添加另一個 Recyclerview
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/mainRecyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:listitem="@layout/item_child" />
item_child
布局包含將水平顯示的 Imageview
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.