微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何将EditText添加到RadioButton?

如何解决如何将EditText添加到RadioButton?

我希望人们能够通过带有单选按钮的对话框从应用程序内部更改状态,以便他们可以从“在线”,“离开”,“请勿打扰”和“离线”更改。我希望人们能够使用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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。