0

How can I change text colour of SwitchCompat?I am showing On and Off text in SwitchCompat and i want to change text colour to white.

<android.support.v7.widget.SwitchCompat
    android:id="@+id/switchttodisableorders"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="right"
    android:padding="5dp"
    android:layout_marginRight="10dp"
    android:checked="true"
    android:textOn="ON"
    android:textOff="OFF"
    app:showText="true"

/>

<style name="Theme.MainActivity" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Set AppCompat’s color theming attrs -->
    <item name="windowActionBar">false</item>
    <item name="android:actionMenuTextAppearance">@style/MyMenuTextAppearance</item>
    <item name="windowNoTitle">true</item>
    <item name="android:textStyle">normal</item>
    <item name="colorControlNormal">@color/colorControlNormal</item>
    <item name="android:textAllCaps">false</item>
    <item name="colorControlActivated">@color/greencompleted</item>
    <item name="actionMenuTextColor">@color/white</item>
    <item name="colorAccent">@color/greenaccepted</item>
    <item name="colorSwitchThumbNormal">@color/red</item>

    <item name="android:statusBarColor" tools:targetApi="lollipop">@color/status_bar_darker_blue</item>
</style>
Android Developer
  • 9,157
  • 18
  • 82
  • 139
  • Ref this [Link](http://stackoverflow.com/questions/36314877/android-switchcompat-style) – Sabari May 28 '16 at 10:57
  • 1
    Read through the accepted answers on these links http://stackoverflow.com/questions/27845595/how-to-change-the-track-color-of-a-switchcompat][1] , http://stackoverflow.com/questions/26714864/how-to-change-the-color-of-a-switchcompat][1] – Franklyn May 28 '16 at 10:58

0 Answers0