• SwipeRefreshLayout的高度测量


    感谢此作者的分享 http://www.cnblogs.com/linjzong/p/5221604.html

    若SwipeRefreshLayout的子布局为一个线性布局LinearLayout,

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
    
        //红色背景
    
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fillViewport="true"
            android:background="#ff00ff">
    
            //黄色背景
    
            <android.support.v4.widget.SwipeRefreshLayout
                android:layout_width="match_parent"
                android:layout_height="fill_parent"
                android:background="#ffff00">
    
                //黑色背景
    
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="100dp"
                    android:background="#000000" />
            </android.support.v4.widget.SwipeRefreshLayout>
        </ScrollView>
    </LinearLayout>
    >

    显示结果确实这个样子的:我们设置100dp显然没起到作用

    原来是子View被强制设置成了SwipeRefreshLayout的高度

     自此提示 若使用SwipeRefreshLayout有这样的需要:只需要上面一部分布局有下拉刷新的效果,SwipeRefreshLayout的高度不要使用wrap__content,

    要指定固定高度,否则会被子布局填充整个屏幕。

  • 相关阅读:
    .net 正在中止线程
    jQuery ajax
    jQuery对checkbox的各种操作
    oracle实验39:触发器
    oracle实验21:建立简单的表,并对表进行简单的DDL操作
    oracle实验20:子查询
    oracle实验18-19:表的连接查询
    oracle实验42:编写包package
    oracle实验25:Sequence序列
    oracle实验17:分组统计函数
  • 原文地址:https://www.cnblogs.com/fajieyefu/p/5536612.html
Copyright © 2020-2023  润新知