我正在尝试开发一个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