Android 滚动子循环器视图和父循环器视图

Android 滚动子循环器视图和父循环器视图,android,android-fragments,android-recyclerview,android-tablayout,Android,Android Fragments,Android Recyclerview,Android Tablayout,应用程序层次结构如下所示: tab1/tab2/tab3/tab4(带ViewPager的选项卡视图) tab1具有另一个带有视图寻呼机的选项卡布局,即 tab1-->子选项卡1、子选项卡2、子选项卡3(带ViewPager的选项卡视图) 在选项卡1中,我有滚动视图,在子选项卡1中,我有循环视图。。现在,当我滚动Tab1选项卡时,Tab1会滚动,直到操作栏和子选项卡的操作栏停止在第一个操作栏下方,要查看recycler视图的内容,我需要再次滚动它。。。我不想发生那种事。。。我希望子选项卡的r

应用程序层次结构如下所示:

  • tab1/tab2/tab3/tab4(带ViewPager的选项卡视图)

  • tab1具有另一个带有视图寻呼机的选项卡布局,即

  • tab1-->子选项卡1、子选项卡2、子选项卡3(带ViewPager的选项卡视图)

在选项卡1中,我有滚动视图,在子选项卡1中,我有循环视图。。现在,当我滚动Tab1选项卡时,Tab1会滚动,直到操作栏和子选项卡的操作栏停止在第一个操作栏下方,要查看recycler视图的内容,我需要再次滚动它。。。我不想发生那种事。。。我希望子选项卡的recyclerview在我滑动Tab1时与Tab1中的父滚动视图一起连续滚动

这是我的主选项卡布局的xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabMode="fixed"
            app:tabGravity="fill"/>
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>

下面是Tab1的代码:

    <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <com.daimajia.slider.library.SliderLayout
                    android:id="@+id/homeBannerSlider"
                    android:layout_width="match_parent"
                    android:layout_height="150dp"
                    app:indicator_visibility="visible"
                    app:pager_animation="Default"
                    app:pager_animation_span="400">

                    <com.daimajia.slider.library.Indicators.PagerIndicator
                        android:id="@+id/custom_indicator"
                        style="@style/AndroidImageSlider_Corner_Oval_Orange"
                        android:layout_alignParentBottom="true"
                        android:layout_centerHorizontal="true"
                        android:background="#00000000" />
                </com.daimajia.slider.library.SliderLayout>
            </RelativeLayout>

            <android.support.v7.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_marginBottom="10dp"
                android:elevation="0dp"
                app:cardCornerRadius="0dp"
                app:cardElevation="0dp">

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <ImageView
                        android:id="@+id/speaker_image"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_centerVertical="true"
                        android:layout_marginLeft="15dp"
                        android:layout_marginRight="15dp"
                        android:background="#F7CA18" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerVertical="true"
                        android:layout_toRightOf="@+id/speaker_image"
                        android:text=" Dynamic Message........" />
                </RelativeLayout>
            </android.support.v7.widget.CardView>

            <android.support.v7.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="30dp"
                android:elevation="0dp"
                app:cardCornerRadius="0dp"
                app:cardElevation="0dp">

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_centerVertical="true"
                        android:layout_marginLeft="20dp"
                        android:text="Latest Results" />
                </RelativeLayout>
            </android.support.v7.widget.CardView>


      <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:orientation="vertical">
                <android.support.design.widget.TabLayout
                    android:id="@+id/home_Sub_TabLayout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:tabTextAppearance="@style/MineCustomTabText"
                    app:tabSelectedTextColor="@color/colorPrimary"
                    app:tabIndicatorColor="@color/colorPrimary"
                    app:tabTextColor="#858585"
                    app:tabMode="fixed"
                    app:tabGravity="fill"/>
                <android.support.v4.view.ViewPager
                    android:id="@+id/home_Sub_Viewpager"
                    android:layout_width="match_parent"
                    android:layout_height="400dp">
                </android.support.v4.view.ViewPager>
            </LinearLayout>
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>

以下是具有recycler视图的Subtab1的xml代码:

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
    android:id="@+id/trending_recycler_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>

</LinearLayout>

我怎样才能做到这一点。。。请建议。。。我尝试了滚动视图和嵌套滚动视图的交替组合,但没有效果。。我应该按程序做些什么吗??提前谢谢