Added MD3 switch
This commit is contained in:
parent
92b4a2fb57
commit
bc29d2ad12
4 changed files with 39 additions and 2 deletions
21
app/src/main/res/drawable/switch_thumb.xml
Normal file
21
app/src/main/res/drawable/switch_thumb.xml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:bottom="4dp"
|
||||||
|
android:left="4dp"
|
||||||
|
android:right="4dp"
|
||||||
|
android:top="4dp">
|
||||||
|
<shape>
|
||||||
|
<solid android:color="?android:colorAccent" />
|
||||||
|
<corners android:radius="24dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<shape>
|
||||||
|
<size
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp" />
|
||||||
|
<solid android:color="@android:color/transparent" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
12
app/src/main/res/drawable/switch_track.xml
Normal file
12
app/src/main/res/drawable/switch_track.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="?android:colorPrimary" />
|
||||||
|
<corners android:radius="56dp" />
|
||||||
|
<size
|
||||||
|
android:width="48dp"
|
||||||
|
android:height="24dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
|
@ -76,9 +76,11 @@
|
||||||
android:id="@android:id/checkbox"
|
android:id="@android:id/checkbox"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@null"
|
app:showText="false"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
|
app:track="@drawable/switch_track"
|
||||||
|
android:thumb="@drawable/switch_thumb"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
|
@ -64,7 +64,9 @@
|
||||||
android:id="@android:id/checkbox"
|
android:id="@android:id/checkbox"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@null"
|
app:showText="false"
|
||||||
|
app:track="@drawable/switch_track"
|
||||||
|
android:thumb="@drawable/switch_thumb"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
|
Loading…
Reference in a new issue