Android swipe to top hover

Source: Internet
Author: User

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:
    1. Place the layout that needs to be suspended outside the collapsingtoolbarlayout, within the Appbarlayout
    2. Set the app:layout_scrollflags of Collapsingtoolbarlayout to scroll
    3. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.