Skip to content

Repository files navigation

NestedStickLayout

先看效果图:

image

NestedStickLayout继承LinearLayout竖直方向,在联合滚动的View上添加app:scrollType="scroll"即可:

<com.gulei.nestedview.NestedStickLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.gulei.nestedview.MainActivity">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="150dp"
        android:scaleType="centerCrop"
        android:src="@mipmap/ic_launcher"
        app:scrollType="scroll" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="@color/colorAccent"
        android:gravity="center"
        android:text="设置了scroll随着布局一起滑动"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:scrollType="scroll" />

    <android.support.design.widget.TabLayout
        android:id="@+id/tablayout"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="@color/colorGreen"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <android.support.v4.view.ViewPager
        android:id="@+id/viewPager"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </android.support.v4.view.ViewPager>

</com.gulei.nestedview.NestedStickLayout>

About

NestedScroll嵌套滑动机制

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages