Android中 xml 屬性 fill_parent、warp_content、match_parent區別

來源:互聯網
上載者:User

標籤:android   xml   控制項   布局   

fill_parent:

指定子組件的高度,寬度與父容器的高度,寬度相同(實際上還要減去填充的空白的距離)。

設定一個構件的布局為fill_parent將強制性地使構件擴充,以填充布局單元內儘可能多的空間。這跟Windows控制項的dockstyle屬性大體一致。設定一個頂部布局或控制項為fill_parent將強制性讓它布滿整個螢幕。

 

wrap_content:

    設定子組件的大小恰好可以包裹子控制項裡面的內容,是相對於子控制項裡面的內容來說的,而另外兩個則是針對於父控制項來說的。


 match_parent:

   該屬性與fill_parent完全相同,而且從Android2.2開始就推薦使用match_parent這個屬性來代替fill_parent屬性。


關於控制項的頁面邊界的屬性:

Android中 xml 屬性 fill_parent、warp_content、match_parent區別

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.