Android ListView中FooterView布局問題

來源:互聯網
上載者:User

標籤:android   c   style   class   blog   code   

在做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內容的高度,也就是字型的高度。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.