如何将 EditText 和 TextView 放置在 RadioButton 中?
我在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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想到的唯一一个想法是使用
android:layout_marginLeft
和android:layout_marginTop
标签将EditText
字段放置在您需要的位置。请务必使用 dip 来支持跨设备的多种密度。然后,如果用户选择您的其他单选按钮,只需从
EditText
中获取值即可。Just one idea that comes to mind is to use
android:layout_marginLeft
andandroid:layout_marginTop
tags to position theEditText
field where you need it to be. Be sure to use dip to support multiple densities across devices.Then, if the user selects your Other radio button, just grab the value from
EditText
.