How to remove padding around Android CheckBox

Solution 1:

There's now a better way of doing this:

android:minWidth="0dp"
android:minHeight="0dp"

Solution 2:

To remove radio button default margins or padding in android

if you using xml

android:minWidth="0dp"
android:minHeight="0dp"

if using programmatically

 radiobtn.setMinimumHeight(0);
 radiobtn.setMinimumWidth(0);

Solution 3:

You could use a negative margin.

android:layout_marginTop = "-5dp"
android:layout_marginRight = "-5dp"

Solution 4:

This works for me in Constraint Layout. I hope it will work for another layout.

<androidx.appcompat.widget.AppCompatCheckBox
                ...
                android:translationX="-5dp"
                 />