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>
NestedScrollView is just like ScrollView , but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. Nested scrolling is enabled by default.
Entering 2 specifies that a scroll is at the second level and is a child of, or nested in, the first level of data, and so on up to 3. A scroll can be nested in another scroll or scroll area, but it cannot be nested in a grid.
NestedScrollView is used when there is a need for a scrolling view inside another scrolling view.
The Flutter documentation defines NestedScrollView as “A scrolling view inside of which can be nested other scrolling views, with their scroll positions being intrinsically linked.” This means that with NestedScrollView , you get two scrolling areas. One is the header part and the other is its body part.
Just change your ScrollView to android.support.v4.widget.NestedScrollView
Post your xml if that doesn't work
ِ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
ViewPager and RecyclerView
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With