Android 如何显示单选按钮被永久选中

Android 如何显示单选按钮被永久选中,android,radio-button,Android,Radio Button,我和你有同样的问题 但在android平台上。。。谁能帮帮我吗。。 我的密码是 <RadioButton android:checked="false" android:id="@+id/BBC" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffff6600" android:text="BBC NEWS" android:typeface="ser

我和你有同样的问题 但在android平台上。。。谁能帮帮我吗。。 我的密码是

<RadioButton
android:checked="false"
android:id="@+id/BBC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffff6600"
android:text="BBC NEWS"
android:typeface="serif"
android:textStyle="bold"
android:layout_x="10px"
android:layout_y="100px">
</RadioButton>


提前感谢…

您可以将值(何时)保存到,在每次加载页面时读取该值,并根据该值查看选中状态。

昨天询问了一个类似内容的问题:


仅使用layout.xml无法解决此问题-您需要保存单选按钮的状态,并在相应的活动启动后再次加载它

您可以使用静态变量,如is_ticked&在用户勾选时设置其值true/false。如果(勾选)将单选按钮设置为选中,则在onCreate()中检查此变量的值,否则取消选中

你可以用这个:

mListView.setItemChecked(selectedPosition,true)//这将检查(启用)所需的单选按钮。

选择位置,您可以使用SharedReferences保存