问题描述
我希望人们能够通过带有单选按钮的对话框从应用程序内部更改状态,以便他们可以从“在线”,“离开”,“请勿打扰”和“离线”更改。我希望人们能够使用EditText单选按钮添加自定义状态。
这是我到目前为止所拥有的:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton android:id="@+id/rbOnline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/online"/>
<RadioButton android:id="@+id/rbAway"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/away"/>
<RadioButton android:id="@+id/rbDnd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dnd"/>
<RadioButton android:id="@+id/rbOffline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/offline"/>
<RadioButton android:id="@+id/rbCustom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RadioGroup>
</RelativeLayout>
最后一个rbCustom
是应具有编辑文本的单选按钮。我应该怎么做才能做到这一点?
解决方法
我遇到了类似的问题,并从中得到了解决方案。答案在这里https://stackoverflow.com/a/11014041/10974012。