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,

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

  • 相关阅读:
    Fiddler实现手机抓包——小白入门
    linux中的baff/cache占用大量内存,如何清理?
    禁止用su切换到root
    Cookie和Session和token
    HTTP 与HTTPS
    Tcp/Ip的分层
    IP基础知识
    计算机基础<一>
    【java基础】内部类
    【JAVA基础】Java中四种权限修饰符
  • 原文地址:https://www.cnblogs.com/fajieyefu/p/5536612.html
Copyright © 2011-2022 走看看