LinearLayoutManager布局实现单行混排:
LinearLayout横排均分多个重复元素,数据1次包含多个。
|A-A-A|
|---B---|
|A-A-A|
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<View
android:id="@+id/icon"
android:layout_width="match_parent"
android:layout_height="68dp"
android:layout_margin="@dimen/dp_6"
android:background=

本文介绍了在Android中使用RecyclerView实现混排的两种方法:LinearLayoutManager布局单行混排和GridLayoutManager设置SpanSizeLookup实现混排。通过示例说明了如何根据数据类型调整元素的排列方式,提供代码链接供参考。
最低0.47元/天 解锁文章
8546

被折叠的 条评论
为什么被折叠?



