No illustration of the eggs, first
Jianshu-top.gif
After reviewing the information, we found that most of the Internet was implemented in this way:
Write a layout that is exactly the same as the part that needs to be suspended, and first set the visibility of the floating area to gone. When the floating area is sliding to the top, the visibility of the floating area B is set to visible. It looks like it's hovering over the top.
See article below:
High profile app, floating layout slide to top hover effect
Android Instance-imitation American app, floating layout slide to top hover effect
Here is another way to do this:
using the controls in the design package
<Android.support.design.widget.CoordinatorLayoutXmlns: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"Android:fitssystemwindows="True"tools:context="Com.peipei.app.MainActivity" ><Android.support.design.widget.AppBarLayoutAndroid:layout_width="Match_parent"android:layout_height="250DP" ><Android.support.design.widget.CollapsingToolbarLayoutapp:layout_scrollflags="Scroll"app:contentscrim="#000000"Android:layout_width="Match_parent"android:layout_height="220DP" ><TextViewandroid:text="Banner Area"android:gravity="Center"Android:textcolor="#ffffff"Android:background="#987545"Android:layout_width="Match_parent"android:layout_height="220DP"/></Android.support.design.widget.collapsingtoolbarlayout><TextViewandroid:gravity="Center"Android:layout_width="Match_parent"android:layout_height="30DP"android:text="Suspended part"/></Android.support.design.widget.appbarlayout><Android.support.v4.widget.NestedScrollViewAndroid:layout_width= "match_parent" android:layout_height= "match_parent" app:layout_behavior= "@string/appbar_scrolling_view_behavior" > <TextView android:layout_width= "wrap_content" android : Layout_height= "wrap_content" android:layout_margin= "@dimen/text_margin" android:text= "@ String/large_text "/> </ Android.support.v4.widget.nestedscrollview></ Android.support.design.widget.coordinatorlayout>
implementation steps:
- Place the layout that needs to be suspended outside the collapsingtoolbarlayout, within the Appbarlayout
- Set the app:layout_scrollflags of Collapsingtoolbarlayout to scroll
- Nestedscroolview Settings for scrolling
App:layout_behavior= "@String/appbar_scrolling_view_behavior"
It's done (remember the root layout if coordinatorlayout)
Final effect:
Damo-jianshu-top.gif
From: http://www.jianshu.com/p/abdb9828a00d
Android swipe to top hover