How to remove unwanted spaces at the right of CheckBox?
by default, the Checkbox has minWidth and minHeight value
you can set its value to 0
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="0dp"
android:minHeight="0dp" />
The result will be like that without any extra spaces
You can wrap CheckBox
in LinearLayout and then use android:gravity="center"
on that layout.
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight=".20"
android:background="#ff0000"
android:gravity="center">
<CheckBox android:id="@+id/bus_route_list_item_reminder"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
</LinearLayout>
As another alternative, you can use RelativeLayout
. This would greatly simplify you layout and you will be able to get rid of layout_weight
.