代码之家  ›  专栏  ›  技术社区  ›  Jyoti JK

更改样式中的单选按钮文本颜色

  •  2
  • Jyoti JK  · 技术社区  · 8 年前

    我试图改变 radiobutton textcolor 如下所示,(自 textcolor 主题中未应用 radiobutton ,我将其添加为单独的样式)

    <style name="BlueTheme" >
            <item name="android:background">#B0E0E6</item>
            <item name="android:textColor">#ffffff</item>
            <item name="android:radioButtonStyle">@style/mystyletwo</item>
        </style>
        <style name="mystyletwo">
            <item name="android:textColor">#ffffff</item>
        </style>
    

    问题是,文本颜色已更改,但圆圈按钮 不可见。

    2 回复  |  直到 7 年前
        1
  •  3
  •   Gowthaman M manas.abrol    8 年前

    试试这个

     <item name="android:tint">#ffffff</item>
    

    (或)

    你可以试试这个

     <android.support.v7.widget.AppCompatRadioButton
            android:id="@+id/rbtn_test"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:buttonTint="@color/primary" />
    

    (或) 添加父主题

     parent="Base.Widget.AppCompat.CompoundButton.RadioButton"
    

    请将这一行添加到您的样式中。

        2
  •  3
  •   Community Mohan Dere    5 年前

    尝试此用途 android:buttonTint

    要应用于按钮图形的色调。

    可以是颜色值,格式为“#rgb”、“argb”、“rrggbb”或“aarrggbb”。

    <RadioButton
        android:layout_width="match_parent"
        app:buttonTint="@color/colorAccent"
        android:layout_height="wrap_content" />