如何将 EditText 和 TextView 放置在 RadioButton 中?

发布于 2024-10-04 01:03:26 字数 151 浏览 0 评论 0原文

我在RelativeLayout 中有一个RadioGroup。我有一些用于不同选项的单选按钮,例如“Bob”、“Joe”和“Fred”。但是,我需要在 RadioButton 旁边添加一个带有 EditText 的“其他...”选项,以防用户想要输入“Steve”。有办法做到这一点吗?

I have a RadioGroup inside of a RelativeLayout. I've got a few RadioButtons for different options, like "Bob", "Joe", and "Fred". However, I need to add an "Other..." option with an EditText right next to a RadioButton in case a user wants to enter "Steve". Is there a way to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

痴情换悲伤 2024-10-11 01:03:26

我想到的唯一一个想法是使用 android:layout_marginLeftandroid:layout_marginTop 标签将 EditText 字段放置在您需要的位置。请务必使用 dip 来支持跨设备的多种密度。

<前><代码><编辑文本
android:layout_marginLeft="65dip"
机器人:layout_marginTop =“100dip”
安卓:layout_height =“wrap_content”
安卓:layout_width =“wrap_content”
android:text="" //>

然后,如果用户选择您的其他单选按钮,只需从EditText中获取值即可。

Just one idea that comes to mind is to use android:layout_marginLeft and android:layout_marginTop tags to position the EditText field where you need it to be. Be sure to use dip to support multiple densities across devices.

<EditText
    android:layout_marginLeft="65dip"
    android:layout_marginTop="100dip"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:text="" />

Then, if the user selects your Other radio button, just grab the value from EditText.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文