TextView与水平RecyclerView上的选定项目一起滚动

时间:2019-06-14 10:31:10

标签: android android-recyclerview

我必须在卧式RecyclerView上显示日期列表,并在所选日期下显示完整日期(TextView),并与RecyclerView一起滚动。

我试图在RecyclerView下的Horizo​​ntalScrollView上添加TextView,但是滚动不同步。我也尝试在RecyclerViewItem上添加TextView,但由于RecyclerView项必须具有固定的宽度,因此日期被裁剪。

<LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_marginBottom="16dp"
            android:layout_marginEnd="24dp"
            android:orientation="vertical"
            android:layout_toEndOf="@+id/command_left_layout">

        <include
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                layout="@layout/view_tracker_activity" />

        <HorizontalScrollView
                android:id="@+id/horizontalScrollView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

            <RelativeLayout
                    android:id="@+id/horizontalLayout"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content">

                <TextView
                        android:id="@+id/horizontalTextView"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Thursay, Apr 2019"/>

            </RelativeLayout>


        </HorizontalScrollView>

预期的行为:

Expected behavior

0 个答案:

没有答案