CeilingLayout
                                
                                 CeilingLayout copied to clipboard
                                
                                    CeilingLayout copied to clipboard
                            
                            
                            
                        CeilingLayout用来控制子View的吸顶联滑,理论上支持实现了NestedScrollingChild的联滑控件,如NestedScrollView、RecyclerView、SmartRefreshLayout等;只需要在xml里配置需要吸顶子View的位置索引就能自动实现吸顶...
1、描述
CeilingLayout用来控制子View的吸顶联滑,理论上支持实现了NestedScrollingChild的联滑控件,如NestedScrollView、RecyclerView、SmartRefreshLayout等;只需要在xml里配置需要吸顶子View的位置索引就能自动实现吸顶联滑效果。
2、模型图
CeilingLayout是LinearLayout的子类,使用方法与竖向LinearLayout一致。

如模型图所示,CeilingLayout竖向排列子View时,吸顶子View之后有且只能再排列一个子View,一般为联动View或包裹住联动View的父容器。
3、xml属性
| 方法名 | 参数 | 描述 | 
|---|---|---|
| ceiling_childIndex | integer | 吸顶子View的位置索引 | 
4、使用
- xml配置
    <!-- 设置位置索引为1的子View吸顶 -->
    <com.github.xubo.statuslayout.CeilingLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:ceiling_childIndex="1">
        
        <View
            android:layout_width="match_parent"
            android:layout_height="100dp"/>
                    
        <TextView
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:text="我是吸顶View"/>
        
        <android.support.v7.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
            
    </com.github.xubo.statuslayout.StatusLayout>
5、gradle
add the dependency:
dependencies {
    ...
    
    implementation 'com.github.xubo.ceilinglayout:CeilingLayout:1.1.1'
}
6、sample
| 示例 | 
|---|
|  | 
7、注意事项
1)、已验证联动View表
- [x] NestedScrollView
- [x] RecyclerView
- [x] SmartRefreshLayout
2)、SmartRefreshLayout-1.1.0已不支持联动
由于SmartRefreshLayout在1.1.0注释了NestedScrollingChild接口实现,表明无法支持与Parent View的嵌套滑动,所以CeilingLayout目前无法支持SmartRefreshLayout-1.1.0联动。
如果需要与SmartRefreshLayout联动,建议把SmartRefreshLayout降级到1.0.5。
3)、错误的位置索引配置
- 不存在的子View位置索引
- 位置索引为0,索引为0吸顶毫无意义