简体   繁体   English

以编程方式编写android:button

[英]Writing android:button programmatically


I would like to use the RadioButton 's property - android:button="@drawable/abc" - programmatically. 我想以编程方式使用RadioButton的属性android:button="@drawable/abc"
How do I write this in Java? 如何用Java编写?

Try this 尝试这个

radioButton.setButtonDrawable(new StateListDrawable());

and perhaps also have a look at this question: 也许也看看这个问题:

programmatically set custom drawables for radio buttons 以编程方式为单选按钮设置自定义绘图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM