Jyoti JK
Jyoti JK

Reputation: 2171

changing radio button text color in style

I tried to change radiobutton textcolor as follows,(since textcolor in theme is not applied for radiobutton, I added it as separate style)

<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>

The problem is , textcolor is changed but the circle button is not visible.

Upvotes: 2

Views: 2648

Answers (2)

AskNilesh
AskNilesh

Reputation: 69734

Try this use android:buttonTint

Tint to apply to the button graphic.

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

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

Upvotes: 3

Gowthaman M
Gowthaman M

Reputation: 8282

Try this

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

(or)

you can try this

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

(or) add parent theme

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

please add this line your style.

Upvotes: 3

Related Questions