user1276092
user1276092

Reputation: 513

How to fill Text background color of android switch

I am Switch view in android app. I need to change the background color of Text "ON" and Text "OFF" dynamically. Can anyone help me in solving this issue?

Upvotes: 2

Views: 967

Answers (1)

Lucian Novac
Lucian Novac

Reputation: 1265

Use:

android:switchTextAppearance="@style/SwitchTextAppearance"

xml styles:

<style name="SwitchTextAppearance" parent="@android:style/TextAppearance.Holo.Small">
    <item name="android:textColor">@color/#xxxxxx</item>
</style>

setSwitchTextAppearance(getActivity(), R.style.SwitchTextAppearance);

Upvotes: 1

Related Questions