android - Scroll Child Recycler view along with parent scroll view -
app hierarchy follows:
tab1/tab2/tab3/tab4 (tab views viewpagers)
tab1 has tab layout view pagers i.e.,
tab1--> subtab1,subtab2,subtab3(tab views viewpagers)
in tab1 have scrollview , in subtab1 have recyclerview.. when scroll tab tab1 tab1 scrolls till action bar , subtab's action bar stop below first action bar , see contents of recycler view need scroll again... not want happen... want subtab's recyclerview scroll continuously along parent scroll view in tab1 when swipe tab1...
here xml main tab layout
<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>
here code 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>
here xml code subtab1 recycler view:
<?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>
how can this... please suggest... have tried alternate combinations of scrollviews n nested scroll views didnt work.. should programatically ?? in advance
Comments
Post a Comment