xml - Android: ViewPager inside ScrollView, with fragments which can contain RecyclerView -


i have screen couple of text views on top. underneath them have view pager 2 fragments. whole screen must scrollable. there 2 fragments in viewpager. first fragment contains recyclerview horizontal layout manager. second fragment contain recyclerview grid layout manager. when on first fragment whole screen scrollable vertically, , recyclerview scrollable horizontally. , problem screen not scrollable. viewpager works , recyclerview within first fragment works. here code tried solutions (nestedscrollview, android:nestedscrollingenabled="true")

activity.xml

<?xml version="1.0" encoding="utf-8"?> <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"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:orientation="vertical"     tools:context="com.okpo.moviesapp.celebrity.view.celebritydetailsactivity">      <android.support.v4.widget.nestedscrollview         android:layout_width="match_parent"         android:layout_height="match_parent"         android:fillviewport="true">          <linearlayout             android:layout_width="match_parent"             android:layout_height="match_parent"             android:background="@color/colorprimary"             android:gravity="center"             android:orientation="vertical">              <textview                 android:id="@+id/celebritydetailsname"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_margintop="@dimen/celebritydetailsnamemargintop"                 android:gravity="center"                 android:textcolor="@android:color/white"                 android:textsize="@dimen/celebritydetailsnametextsize"                 tools:text="henry cavill" />              <textview                 android:id="@+id/celebritydetailsage"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_margintop="@dimen/celebritydetailsagemargintop"                 android:gravity="center"                 android:textcolor="@android:color/white"                 android:textsize="@dimen/celebritydetailsagetextsize"                 tools:text="age 33" />              <textview                 android:id="@+id/celebritydetailsbirthplace"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_marginbottom="@dimen/celebritydetailsbirthplacemarginbottom"                 android:layout_margintop="@dimen/celebritydetailsbirthplacemargintop"                 android:gravity="center"                 android:textcolor="@android:color/white"                 android:textsize="@dimen/celebritydetailsbirthplacetextsize"                 tools:text="jersey, channel islands, uk" />              <android.support.design.widget.tablayout                 android:id="@+id/celebritydetailstabs"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_gravity="left"                 app:tabindicatorcolor="@android:color/white"                 app:tabtextcolor="@android:color/white"                 app:tabmode="scrollable" />              <android.support.design.widget.coordinatorlayout                 android:layout_width="wrap_content"                 android:layout_height="wrap_content">                 <android.support.v4.view.viewpager                     android:layout_width="match_parent"                     android:layout_height="match_parent"                     android:nestedscrollingenabled="true"                     android:id="@+id/celebritydetailsviewpager" />             </android.support.design.widget.coordinatorlayout>           </linearlayout>      </android.support.v4.widget.nestedscrollview>  </linearlayout> 

first fragment .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:background="@android:color/white">     <android.support.v7.widget.recyclerview         android:id="@+id/celebritydetailsphotos"         android:layout_width="match_parent"         android:nestedscrollingenabled="true"         android:layout_height="@dimen/celebrityphotoheight" />      <textview         android:id="@+id/celebritydetailsbio"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:padding="8dp" /> </linearlayout> 

i didn't write second fragment yet

here first fragment's recyclerview item .xml

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="wrap_content"     android:layout_height="match_parent"     android:layout_margin="8dp"     android:orientation="vertical">      <imageview         android:id="@+id/celebritydetailsphotosimage"         android:layout_width="@dimen/celebrityphotowidth"         android:layout_height="@dimen/celebrityphotoheight" />  </linearlayout> 


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -