How to Change the Width of a Finger SwitchCompat

My question is about Android SwitchCompat.

The style I want:

enter image description here

But my switching style is:

enter image description here

My finger width is something wrong. (Please ignore the track size)

This is my xml code:

<android.support.v7.widget.SwitchCompat
    app:switchMinWidth="@dimen/_108px"
    android:layout_width="@dimen/_108px"
    android:layout_height="@dimen/_60px"
    android:thumb="@drawable/switch_thumb_selector"
    app:track="@drawable/switch_track_selector" />

android:layout_widthhelps set the width of the track, and android:layout_heighthelps set the height of the thumb. But I want to set the width of the thumb. How to set thumb width?

+4
source share

Source: https://habr.com/ru/post/1610388/


All Articles