简体   繁体   中英

Writing android:button programmatically


I would like to use the RadioButton 's property - android:button="@drawable/abc" - programmatically.
How do I write this in Java?

Try this

radioButton.setButtonDrawable(new StateListDrawable());

and perhaps also have a look at this question:

programmatically set custom drawables for radio buttons

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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