appbarlayout 学习总结

2018-07-08  本文已影响0人  我就是杨过

控件介绍 (这里在理解之后需要修改 )

五种滚动属性介

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

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?android:attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll" />
</android.support.design.widget.AppBarLayout>

将子view与ScrollView 联系起来

//注意外面有一层 CoordinateLayout 作为 NestedScrollView 和 AppBarLayout 的父布局 才可以使用 否则是是没用的
<android.support.v4.widget.NestedScrollView

        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

       <!--将你的内容放在这里-->

    </android.support.v4.widget.NestedScrollView>
上一篇 下一篇

猜你喜欢

热点阅读