Android滑动到顶部悬停

http://www.open-open.com/lib/view/open1473834348870.html

<android.support.design.widget.CoordinatorLayout
    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"
    android:fitsSystemWindows="true"
    tools:context="com.peipei.app.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="250dp">

        <android.support.design.widget.CollapsingToolbarLayout
            app:layout_scrollFlags="scroll"
            app:contentScrim="#000000"
            android:layout_width="match_parent"
            android:layout_height="220dp">

            <TextView
                android:text="banner区域"
                android:gravity="center"
                android:textColor="#ffffff"
                android:background="#987545"
                android:layout_width="match_parent"
                android:layout_height="220dp"/>

        </android.support.design.widget.CollapsingToolbarLayout>

        <TextView
            android:gravity="center"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:text="悬浮的部分"/>

     </android.support.design.widget.AppBarLayout>

     <android.support.v4.widget.NestedScrollView
            android: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>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 无图说卵,先上图 查阅资料后,发现网上大部分都是用这种方法实现的:多写一个和需要悬浮的部分一模一样的layout,...
    peipeicn阅读 16,340评论 22 76
  • 开发的过程中,会遇到一些不好解决的问题,列表太多会导致滑动事件的冲突,下图中的情况中就是一个很典型的案例。 前言 ...
    胡二囧阅读 10,671评论 0 5
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,691评论 2 45
  • 很久以前人们有一种共识,那就是大脑的神经细胞以及神经链接在成年之前就已经固化,成人之后就开始不可逆的衰退...
    陆牛阅读 4,088评论 0 0
  • 柳香芹 京城知名“爱心人士”柳虎,刚从河北涞源助学帮困回来的他,看上去有些步履蹒跚、疲惫不堪,但他那特有的执着与坚...
    柳志儒阅读 3,567评论 0 0