开发者

Android Button drawableLeft - how to hardcode it (no xml)

开发者 https://www.devze.com 2023-01-23 04:16 出处:网络
How can I add a \"drawable left\" icon to a button object? I mean something like this: Button button = 开发者_运维问答new Button();

How can I add a "drawable left" icon to a button object?

I mean something like this:

Button button = 开发者_运维问答new Button();
button.setDrawableLeft(R.drawable...);


Use Button.setCompoundDrawablesWithIntrinsicBounds(..) which relates to android:drawableLeft attribute.

0

精彩评论

暂无评论...
验证码 换一张
取 消