我想设计一个带有图标和文本嵌入的一些大按钮的TableLayout。我发现了一些类似的问题,但不是相同的1。我简化的XML布局是:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow android:id="@+id/TableRow01" android:gravity="center">
<Button android:text="@string/telephone" android:drawableTop="@drawable/phone" android:id="@+id/button_phone"></Button>
<Button android:text="@string/help" android:src="@drawable/help" android:id="@+id/button_help"></Button>
</TableRow>
</TableLayout>图标图像有点大,所以我想用Android调整它们的大小,但是android:height参数调整的是按钮的大小,而不是嵌入的图像。你有没有想法得到一个按钮与文本和图像“可调整大小”?
发布于 2010-07-28 05:16:24
使用ScaleType属性(Documentation)
编辑:有关支持多种屏幕尺寸的信息,请参阅here。如果你遵循android的约定,而不是仅仅尝试使用非常大的drawable,并在运行时针对较小的屏幕调整它们的大小,你将会有更好的性能和更少的问题。
https://stackoverflow.com/questions/3345783
复制相似问题