在RadioButton中使用图像而不是文本

chr*_*ina 4 android radio-button

检查图像

检查文字

Android,我想使用RadioButton,但我不想检查纯文本.如何在第一张图像而不是第二张图像中显示?使用RadioGroupRadioButton.

Ank*_*sal 9

没有什么特别的事情..只需在其中添加drawable:

<RadioButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:drawableLeft="@drawable/ic_launcher"/>
Run Code Online (Sandbox Code Playgroud)

对于这样的效果:

在此输入图像描述

RadioButton本身包含一个TextView默认..所以你可以做任何存在的所有操作TextView.

奖励:如果您想更改显示check状态的圆点,只需更新android:button标签即可引用您自己的标签drawable.