Android: How to change CheckBox size?
Here is a better solution which does not clip and/or blur the drawable, but only works if the checkbox doesn't have text itself (but you can still have text, it's just more complicated, see at the end).
<CheckBox android:id="@+id/item_switch" android:layout_width="160dp" <!-- This is the size you want --> android:layout_height="160dp" android:button="@null" android:background="?android:attr/listChoiceIndicatorMultiple"/>
The result:
What the previous solution with scaleX
and scaleY
looked like:
You can have a text checkbox by adding a TextView
beside it and adding a click listener on the parent layout, then triggering the checkbox programmatically.
You just need to set the related drawables and set them in the checkbox:
<CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="new checkbox" android:background="@drawable/my_checkbox_background" android:button="@drawable/my_checkbox" />
The trick is on how to set the drawables. Here's a good tutorial about this.