I'm curious to know whether it's possible to change the default spacing that's placed around MaterialCheckBox
... or whether there are plans to allow for this.
Let's say, for the sake of example, I have a CheckBox
defined with four TextViews
around it (to the left, right, top and bottom of it) and I specify no margins on any of the five Views
. If I define my app's theme as Theme.AppCompat.Light
then this CheckBox
is rendered with equal spacing around it as follows:
If I change the app's theme to Theme.MaterialComponents.Light
and make no other changes to the app then the CheckBox
is rendered as follows:
Note the unequal spacing which I would like to customise on a per-need basis. There's nothing mentioned in the MaterialCheckBox
documentation and I can't see anything obvious in the class definition about being able to change this spacing.
(For what it's worth I'm using the latest version of the com.google.android.material:material library
, i.e. 1.1.0-alpha03
. And everything I've said above holds regardless of whether I define a CheckBox
, AppCompatCheckBox
or MaterialCheckBox
in my layout. The key thing is changing the theme from Theme.AppCompat.Light
to Theme.MaterialComponents.Light
.)
This looks related to MaterialCheckBox enforcing a 48dp minTouchTargetSize for accessibility using android:minWidth in the CheckBox style (this should be added to the documentation). Setting android:minWidth to 0dp should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With