首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Android按钮中获取调整大小的图像

在Android按钮中获取调整大小的图像
EN

Stack Overflow用户
提问于 2010-07-28 00:32:14
回答 1查看 12.6K关注 0票数 3

我想设计一个带有图标和文本嵌入的一些大按钮的TableLayout。我发现了一些类似的问题,但不是相同的1。我简化的XML布局是:

代码语言:javascript
复制
<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参数调整的是按钮的大小,而不是嵌入的图像。你有没有想法得到一个按钮与文本和图像“可调整大小”?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-07-28 05:16:24

使用ScaleType属性(Documentation)

编辑:有关支持多种屏幕尺寸的信息,请参阅here。如果你遵循android的约定,而不是仅仅尝试使用非常大的drawable,并在运行时针对较小的屏幕调整它们的大小,你将会有更好的性能和更少的问题。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3345783

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档