coordinatorlayout介绍:
coordinatorlayout是5.0之后推出一个功能。使用布局完成特效比较简单。它像一个协调者,来协助一些属性完成一些特效。appbarlayout,是一个可以滑动的控件,但是必须在coordinatorlayout里面才可以有滑动效果的,appbarlayout也是5.0推出的新特效。在这里不多说了,具体详细的一些属性,你可以在网上查找。这个属性用起来特别方便的,好像有的公司就推荐用这一种布局。
需要依赖的包:
compile 'com.android.support:design:24.2.0'
xml布局:
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="match_parent" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <android.support.design.widget.AppBarLayout android:id="@+id/mAppbarLayout" android:fitsSystemWindows="true" android:layout_width="match_parent" android:layout_height="300dp"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/mCtbarLayout" android:fitsSystemWindows="true" app:layout_scrollFlags="scroll|enterAlways" android:layout_width="match_parent" android