zoukankan      html  css  js  c++  java
  • 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,

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

  • 相关阅读:
    毕业设计-角色用户管理
    质因数分解
    高次同余方程
    线性同余方程
    乘法逆元
    约数,整除
    扩展欧几里得算法
    同余
    P2303 [SDOI2012] Longge 的问题
    最大公约数(gcd)与最小公倍数(lcm)
  • 原文地址:https://www.cnblogs.com/fajieyefu/p/5536612.html
Copyright © 2011-2022 走看看