android黏性头部滑动布局
#StickyLayout
##How to use
这不是一个第三发库,只是根据需求对 Android
的触摸事件的一次实践, StickyLayout
继承自 LinearLayout
嵌套在头布局和列表布局的最外层即可,使用起来非常简单。
<com.licrafter.scrolllayout.view.StickyLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:orientation="vertical">
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:clickable="true"
android:orientation="vertical">
<ImageView
android:id="@+id/header01"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#50ae"
android:clickable="true"
android:scaleType="centerCrop"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<View
android:background="#eb4f38"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content"/>
<View
android:background="#ea8010"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content"/>
<View
android:background="#f4c600"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content"/>
<View
android:background="#9d55b8"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="120dp"
android:background="#50de"
android:clickable="true">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@mipmap/bg_01"/>
</LinearLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<android.support.v4.view.ViewPager
android:id="@+id/goodsViewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</com.licrafter.scrolllayout.view.StickyLayout>