Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can i create a nestedScroll Layout like this?

enter image description here

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>
like image 744
tiny sunlight Avatar asked Nov 02 '15 04:11

tiny sunlight


People also ask

What is nested scrolling?

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.

How many nested scrolls are allowed in a scroll area?

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.

Why we use nested scroll view?

NestedScrollView is used when there is a need for a scrolling view inside another scrolling view.

What is nested scroll view in flutter?

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.


2 Answers

Just change your ScrollView to android.support.v4.widget.NestedScrollView

Post your xml if that doesn't work

like image 114
arbrcr Avatar answered Oct 11 '22 14:10

arbrcr


ِ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

like image 36
armanso Avatar answered Oct 11 '22 14:10

armanso