
我想设计一个带有图标和文字嵌入的大按钮的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参数调整按钮大小,而不是嵌入图像.你有没有想过让文字和图像按钮“可调整大小”?
解决方法:
使用ScaleType属性(Documentation)
编辑:有关使用您的drawable支持多种屏幕尺寸的信息,请参阅here.如果您遵循androID约定而不是尝试使用非常大的drawable并在运行时为较小的屏幕调整它们,那么您将获得更好的性能和更少的问题.
以上是内存溢出为你收集整理的在Android按钮内获取调整大小的图像全部内容,希望文章能够帮你解决在Android按钮内获取调整大小的图像所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)