Reputation: 6251
I think it can be achieved by NestedScrollingChild
NestedScrollingParent
.
But I can't really understand them.Who can help me out!
Product manager insists on the design.
The ScrollView
contains a LinearLayout
,a "TabLayout" and a ViewPager
.
The ViewPager
contains 2 fragment
contains RecyclerView
or just only 2 RecyclerView
.
When the ScrollView
scroll to Bottom , the RecyclerView
can scroll to Bottom.
When the RecyclerView
scroll to Top , the ScrollView
can scroll to Top.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="1000dp" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="60dp"></TableLayout>
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"></android.support.v4.view.ViewPager>
</LinearLayout>
</ScrollView>
Upvotes: 8
Views: 485
Reputation: 815
Just change your ScrollView to android.support.v4.widget.NestedScrollView
Post your xml if that doesn't work
Upvotes: 6
Reputation: 144
ِYou can do that, but it's not good at all to use this type of layout
First you need add "wrap_content" abilty ViewPager and RecyclerView's
Now you can use scrollview easily, put all item in it
If you want some effect or something when user scrolling or some item get visible in scrolling you can get position of item then make listener on "OnScrollChangedListener" of scrollview
Upvotes: 2