我在做一个多项选择测试。
有一些图像作为答案,有单选和多选
<radio button or checkbox here> <image here>
我需要把 drawable folder 里的图像添加在 radiobuttons 或者 checkboxes 的右边。
如何实现?
我在做一个多项选择测试。
有一些图像作为答案,有单选和多选
<radio button or checkbox here> <image here>
我需要把 drawable folder 里的图像添加在 radiobuttons 或者 checkboxes 的右边。
如何实现?
在 xml 中添加下面的代码
<RadioButton
android:drawableRight="@drawable/icon"
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></RadioButton>
也可以参考:
RadioButton rb = (RadioButton) findViewById(R.id.radioButton1);
Drawable d = getResources().getDrawable(R.drawable.icon);
rb.setCompoundDrawables(null, null, d, null);