【问题标题】:Radiobutton with text on top顶部带有文本的单选按钮
【发布时间】:2012-04-11 21:46:19
【问题描述】:

如何制作一个单选按钮,在其中使用 android:button 更改可绘制对象并在顶部显示文本?使用常规单选按钮,文本在可绘制对象后面分层。

现在我开始在我自己的单选按钮的实现中感到沮丧。

我想要这样的东西:

<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >
    <RadioButton
        android:text="something that is on top"
        android:id="@+id/toggle_tab_left"
        android:button="@drawable/main_selector"
        style="@style/TabStyle"/>
    <RadioButton 
        android:button="@drawable/info_selector"
        android:text="something that is on top"
        android:id="@+id/toggle_tab_right"
        style="@style/TabStyle"/>
</RadioGroup>

【问题讨论】:

  • 你到底想告诉我什么?
  • 尝试使用 RadioButton 重力。
  • 重力应该如何帮助?我希望它在顶部/上方,就像在 Z 轴而不是 x/y 轴一样。问题是图像位于文本顶部,因此您无法阅读...

标签: android radio-button


【解决方案1】:

您可以使用background 属性来代替图形,并将button 设置为@null 或透明颜色。

【讨论】:

    猜你喜欢
    • 2013-10-06
    • 2020-09-12
    • 2020-12-08
    • 2018-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多