From bc29d2ad1212efe231bc65c009e85e192d2def0e Mon Sep 17 00:00:00 2001 From: Prathamesh More Date: Mon, 4 Oct 2021 11:29:24 +0530 Subject: [PATCH] Added MD3 switch --- app/src/main/res/drawable/switch_thumb.xml | 21 +++++++++++++++++++ app/src/main/res/drawable/switch_track.xml | 12 +++++++++++ .../main/res/layout/list_item_view_switch.xml | 4 +++- .../layout/list_item_view_switch_no_title.xml | 4 +++- 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/drawable/switch_thumb.xml create mode 100644 app/src/main/res/drawable/switch_track.xml diff --git a/app/src/main/res/drawable/switch_thumb.xml b/app/src/main/res/drawable/switch_thumb.xml new file mode 100644 index 00000000..c5f48c5c --- /dev/null +++ b/app/src/main/res/drawable/switch_thumb.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/switch_track.xml b/app/src/main/res/drawable/switch_track.xml new file mode 100644 index 00000000..cb59bb7e --- /dev/null +++ b/app/src/main/res/drawable/switch_track.xml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/list_item_view_switch.xml b/app/src/main/res/layout/list_item_view_switch.xml index bf08f605..a536b1fa 100644 --- a/app/src/main/res/layout/list_item_view_switch.xml +++ b/app/src/main/res/layout/list_item_view_switch.xml @@ -76,9 +76,11 @@ android:id="@android:id/checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@null" + app:showText="false" android:clickable="false" android:focusable="false" + app:track="@drawable/switch_track" + android:thumb="@drawable/switch_thumb" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/list_item_view_switch_no_title.xml b/app/src/main/res/layout/list_item_view_switch_no_title.xml index 2eeb6a18..0a021dd2 100644 --- a/app/src/main/res/layout/list_item_view_switch_no_title.xml +++ b/app/src/main/res/layout/list_item_view_switch_no_title.xml @@ -64,7 +64,9 @@ android:id="@android:id/checkbox" android:layout_width="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:focusable="false" app:layout_constraintBottom_toBottomOf="parent"