【发布时间】:2012-11-25 15:44:51
【问题描述】:
我想创建一个“真实”按钮的按钮组? 我想向用户显示包含他的参加选项的按钮:是、否和 Meybe。 我想为此显示使用按钮。 怎么做?
【问题讨论】:
标签: android button radio-button
我想创建一个“真实”按钮的按钮组? 我想向用户显示包含他的参加选项的按钮:是、否和 Meybe。 我想为此显示使用按钮。 怎么做?
【问题讨论】:
标签: android button radio-button
只需在drawable文件夹中创建一个选择器xml文件
checkbox_background.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_checked="true" android:drawable="@drawable/checkbox_active" />
<item android:state_checked="false" android:drawable="@drawable/checkbox_inactive" />
</selector>
并将此背景应用于您的单选按钮
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/checkbox_background" />
【讨论】: