0

I have a simple android.support.v7.widget.SwitchCompat which is shown below

<android.support.v7.widget.SwitchCompat
    android:id="@id/settings_toggle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:text=""
    android:textOff=""
    android:textOn=""
    android:saveEnabled="false"
    android:autoText="false"
    android:theme="@style/ToggleButton"/>

My Style

<style name="ToggleButton" parent="@style/Theme.AppCompat.Light">
    <item name="colorControlActivated">@color/blue</item>
</style>

The above code seems working fine in API level 20 or greater. Its not working in API level < 20. Min SDK support is 16. Couldn't figure out the problem. Any inputs are appreciated. Thanks!

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
prago
  • 5,225
  • 5
  • 25
  • 27

1 Answers1

0

I was able to figure out the root cause of the issue. The existing style of the activity is overriding the style of the switch compat. Applying same style of switch compat to activity fixes the issue.

prago
  • 5,225
  • 5
  • 25
  • 27