Skip to content

Commit

Permalink
Provide entrypoint to customizing MaterialCheckBox
Browse files Browse the repository at this point in the history
  • Loading branch information
aanorbel committed Dec 2, 2023
1 parent c3dc5c0 commit 1cfa7c0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/check_box_custom_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:attr="http://schemas.android.com/aapt">
<item android:drawable="@drawable/check_box" android:state_checked="true" />
<item android:drawable="@drawable/check_box_indeterminate" app:state_indeterminate="true" />
<item android:drawable="@drawable/check_box_outline_blank" />
</selector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/check_box_indeterminate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#000000"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M19,3H5C3.9,3 3,3.9 3,5v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V5C21,3.9 20.1,3 19,3zM17,13H7v-2h10V13z" />
</vector>
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_overview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@

<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/switch_tests"
android:button="@drawable/check_box_custom_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:checkedState="indeterminate" />
Expand Down

0 comments on commit 1cfa7c0

Please sign in to comment.