小编Sat*_*ish的帖子

如何在android中同步两个Recyclerviews的滚动?

我正在尝试使用 Recyclerviews 在 android 中创建一个 EPG。它需要固定的顶行水平滚动显示与时间相对应的节目,固定最左列垂直滚动显示各种频道。

基于这个SO 答案,我带来了以下内容设计

    <?xml version="1.0" encoding="utf-8"?>
    <!--Outer container layout-->
    <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    tools:context=".MainActivity">

    <!--To display Channels list-->
    <LinearLayout
        android:layout_width="150dp"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <!--Position (0,0)-->
        <TextView
            android:id="@+id/tv_change_date"
            android:layout_width="match_parent"
            android:layout_height="50dp" />

        <android.support.v7.widget.RecyclerView
            android:id="@+id/rcv_channel_name"
            android:scrollbars="none"
            android:layout_width="150dp"
            android:layout_height="match_parent"/>

        </LinearLayout>


    <!--To display Time and Programs list-->
    <HorizontalScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <!--Time horizontal list-->
                <android.support.v7.widget.RecyclerView
                    android:id="@+id/rcv_vertical_header"
                    android:scrollbars="none"
                    android:layout_width="match_parent"
                    android:layout_height="50dp"/>

                <!--Vertical list whose each element is horizontal list to show programs-->
                <android.support.v7.widget.RecyclerView
                    android:id="@+id/rcv_vertical"
                    android:scrollbars="vertical"
                    android:layout_width="match_parent" …
Run Code Online (Sandbox Code Playgroud)

android epg android-scroll android-recyclerview

5
推荐指数
1
解决办法
6283
查看次数