Android ListView中FooterView布局問題


在做ListView上拉加載中遇到的問題,不清楚什么原理,具體也沒仔細研究,Mark一下。

布局界面如下:

foot1.xml

 

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:background="#f1f1f1" >
    
    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="50dip"
        android:gravity="center"
        android:text="查看更多"
        android:textSize="18sp" />

</RelativeLayout>

foot2.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="50dip"
    android:gravity="center"
    android:background="#f1f1f1" >
    
    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="查看更多"
        android:textSize="18sp" />

</RelativeLayout>

看似效果一樣的兩個布局界面,在ListView的FooterView中顯示卻是兩個效果。
footer1.xml中設置了TextView的高度為50dip,而根布局則設置為包裹內容,這樣在實際顯示效果中ListView的Footer確實高度是50dip了,但是footer2.xml中在根布局中設置了高度為50dip,在實際加載到ListView的FooterView中后卻沒有效果,他的高度變為了wrap_content,而TextView的高度也設置為wrap_content,所以實際顯示出來的高度就是TextView內容的高度,也就是字體的高度。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM