起初看到需求以为是个复杂效果,要钻研很长时间,但是看到项目中有之前大神写的代码,把相关功能代码片段摘出来,发现很简单就实现了效果,记录一下
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.core.widget.NestedScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/ll_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_F6F6F6"
android:orientation="vertical">
<!--加入悬浮布局上方布局-->
<!--以lineAddNavigationFixation 为分界线 该布局为悬停前布局-->
<LinearLayout
android:id="@+id/lineAddNavigationFixation"
android:layout_width="match_parent"