我怎样才能让LinearLayout(或任何其他ViewGroup)假定其子视图的大小,而不是假定背景图像的大小?如何包装内容视图而不是后台可绘制?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/large_image300x300pix">
<TextView android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello world!"/>
</LinearLayout>
线性布局变得与背景图像大小相同。 如何让我的线性布局呈现与textview相同的大小?
是的,不幸的是我的图像没有平铺,并且不适用于9贴片。 – Petrus 2010-11-30 13:29:39
我不确定这是否正确...我仍然看到使用9补丁时发生同样的问题。这9个补丁将会扩展,但似乎不会缩小。 – greg7gkb 2012-02-06 19:00:34