利用google的design包里的CoordinatorLayout和AppBarLayout即可快速便捷实现,先看一下实现的效果图,如下:
Screen Record_2019-02-22-15-00-37.gif
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=".ThirdActivity">
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:background="@color/black"
android:textColor="@color/white"
android:gravity="center"
android:text="这是需要滑动的布局"
android:layout_width="match_parent"