【问题标题】:How can I place an EditText and TextView in a RadioButton?如何在 RadioButton 中放置 EditText 和 TextView?
【发布时间】:2010-11-21 23:36:37
【问题描述】:

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

【问题讨论】:

    标签: java android radio-button customization android-relativelayout


    【解决方案1】:

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

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

    然后,如果用户选择您的 Other 单选按钮,只需从 EditText 获取值。

    【讨论】:

      猜你喜欢
      • 2023-03-03
      • 1970-01-01
      • 2012-09-07
      • 1970-01-01
      • 2013-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多