【发布时间】:2021-03-11 06:13:31
【问题描述】:
我尝试实现this 答案并且它有效,但前提是这两个列表都已预填充,但在我的情况下,一个列表是预填充的,另一个是动态递增/递减的。
黑框代表循环列表,可以动态增加/减少,主要作用是显示用户喜欢的字体。
红色框代表所有可用的字体,它们是预填充的。
我希望这两个列表在滚动中相互流动,这样用户就不会注意到它们实际上是两个不同的列表。
我的 xml 代码:
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:padding="@dimen/home_section_padding"
android:background="@color/background"
android:orientation="vertical"
android:layout_height="match_parent"
tools:context=".MainActivity">
<EditText
android:layout_width="match_parent"
android:id="@+id/editText"
android:textColorHint=" #C0C0C0"
android:hint="Paste"
android:textColor="@color/text_color"
android:inputType="text"
android:layout_height="wrap_content"/>
<Button
android:layout_width="match_parent"
android:text="Style"
android:textStyle="bold"
android:textColor="@color/text_color"
android:layout_marginBottom="10dp"
android:fontFamily="serif-monospace"
android:textAppearance="?android:textAppearanceLarge"
android:background="@drawable/round_shape_for_button"
android:onClick="fire"
android:id="@+id/button"
android:layout_height="wrap_content"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyelerViewFav"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</androidx.recyclerview.widget.RecyclerView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyelerView"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp" />
</LinearLayout>
【问题讨论】:
标签: android android-layout android-recyclerview nestedrecyclerview