Android SwitchCompat thumb misalignment… here is a solution to the problem.
Android SwitchCompat thumb misalignment
I
want to use SwitchCompat
in Android Studio, I put it in build.gradle:
compile 'com.android.support:appcompat-v7:21.+'
But the thumb is not centered with the slider.
Here is my xml:
<android.support.v7.widget.SwitchCompat
android:id="@+id/allarme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_gravity="right" />
Can you help me?
Solution
I finally found the problem: there is a bug in AppCompat (currently v21.0.3) affecting HDPI devices.
More information: https://code.google.com/p/android/issues/detail?id=78262
Workaround:
Copy this file into your app’s res/drawable-hdpi: https://www.mediafire.com/?6c7537yi73m1e6m