如何设置属性"安卓drawableTop"在运行按钮的 [英] How to set property "android:drawableTop" of a button at runtime

查看:107
本文介绍了如何设置属性"安卓drawableTop"在运行按钮的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置属性安卓drawableTop 运行时一个按钮

How to set property "android:drawableTop" of a button at runtime

推荐答案

使用

button.setCompoundDrawablesWithIntrinsicBounds(左,上,右,下);

设定的可绘(如有的话),以出现的,上面的左边,右边,和下面的文字。使用0,如果你不希望可绘制在那里。所述可绘制'边界将被设置为它们的内在边界

Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use 0 if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds.

如果您使用

button.setCompoundDrawables(左,上,右,下);

设定的可绘(如有的话),以出现的,上面的左边,右边,和下面的文字。使用空,如果你不想绘制对象那里。在可绘必须已经有<一个href="http://developer.android.com/reference/android/graphics/drawable/Drawable.html#setBounds%28android.graphics.Rect%29">setBounds(Rect)调用。

Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use null if you do not want a Drawable there. The Drawables must already have had setBounds(Rect) called.

这篇关于如何设置属性&QUOT;安卓drawableTop&QUOT;在运行按钮的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆