简体   繁体   English

RadioButton图像

[英]RadioButton Image

How would I modify the .xml and .java files so that a RadioButton shows one image when selected and another image when not selected? 如何修改.xml和.java文件,以便RadioButton在选中时显示一个图像,在未选择时显示另一个图像?

Example for RadioButton I am learning from: http://www.androidpeople.com/android-radiobutton-example/ 我正在学习的RadioButton示例: http//www.androidpeople.com/android-radiobutton-example/

是一个使用StateListDrawable和RadioButtons的示例,似乎可以执行您想要的操作。

您需要将其android:button属性设置为至少具有两种状态的StateListDrawable :selected = true和默认值(未选中)。

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

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