Switch formázása

Az alap Switch így néz ki formázás nélkül (a telefon témájának beállításától függően)

activity_main.xml

    <Switch
        android:text="Switch"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView"
        android:layout_alignParentStart="true"
        android:layout_marginStart="27dp"
        android:layout_marginTop="17dp"
        android:theme="@style/switchszin1"
        android:id="@+id/switch1" />

A styles-ben írjuk hozzá a switchszin1 sorait

styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
    <style name="switchszin1">
        <item name="android:colorForeground">#00ff00</item>
        <item name="colorControlActivated">#009f3c</item>
    </style>

</resources>

És a végeredmény