单选平按钮?单选、按钮

2023-09-05 11:23:01 作者:边哭边笑

有没有一种办法风格单选按钮为平面按钮?我有四个选项:

Is there a way to style a RadioButton as a flat button? I have four options:

| btn1 | btn2 | btn3 | btn4 |

而不必紧挨着的小收音机圆

,我想显示每个作为只是一个普通的平板按钮。这是可能的,而无需提请他们自己?

instead of having the little radio circle next to each, I'd like to show each as just a plain flat button. Is that possible without having to draw them myself?

感谢

推荐答案

是的,它是可能的。

在XML集, 安卓按钮=@空

而如果你要动态地做到这一点, setButtonDrawable(新StateListDrawable());

And in case you want to do it dynamically, setButtonDrawable(new StateListDrawable());