【问题标题】:Need to change layout of radio buttons需要更改单选按钮的布局
【发布时间】:2011-06-08 17:03:49
【问题描述】:

我有 2 个单选按钮,我想把它们放在一起。现在他们喜欢

Radio button 1
Radio button 2

我想做

Radio button 1    Radio button 2

这是我的单选按钮代码,有帮助吗?

    <RadioGroup
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical">
  <RadioButton android:id="@+id/radio_male"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Male" 
      android:layout_below="@id/gender"/>
  <RadioButton android:id="@+id/radio_female"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Female" />
</RadioGroup>

【问题讨论】:

  • 什么?您想要的与您拥有的 2 个示例是相同的。

标签: android xml android-widget radio-button


【解决方案1】:

你有没有花时间在这上面?

也许android:orientation="vertical" 意味着什么。

【讨论】:

  • 哇,对不起。我不敢相信我错过了这个! Grrrrrrrrrrrr 整天都在编程。我真的应该休息一下!对不起!
【解决方案2】:

“之前”和“之后”布局在您编写时没有区别...

尽管如此:您的 XML 中有 android:orientation="vertical"。试试android:orientation="horizontal";这应该将它们放在同一行,彼此相邻。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-27
    • 2021-04-02
    • 1970-01-01
    • 1970-01-01
    • 2020-12-23
    • 2017-05-08
    • 2012-03-17
    • 1970-01-01
    相关资源
    最近更新 更多