我正在嘗試開發一個Android佈局,其中我有一個Image
和some text
。如何定義屏幕高度的佈局元素高度
我想要的形象是1屏幕高大和向下滾動時的內容的其餘部分將被顯示。
我應該在layout.xml中設置什麼值。所以圖像正好(獨立於設備)1屏幕高?
爲了使問題更清楚,用CSS我可以很容易地獲得與following code全高畫面:
<html>
<style>
html, body {
height: 100%;
}
.image {
height: 100%;
background-image: url(http://kolobee.com/images/stings/baelo-claudia.1ovl/ad2p/620x620.jpg);
background-position: center;
}
</style>
<body>
<div class="image"></div>
<h1>Title</h1>
<p>More text</p>
</body>
</html>
http://stackoverflow.com/questions/15705832/listview-with-different-layout-inflation-for-each-row/15706073#15706073。使用列表視圖並根據行類型膨脹自定義佈局。 – Raghunandan
這不是任何你可以在xml中真正做到的事情,你將不得不將圖像調整到屏幕大小 – tyczj