layout_gravity not working
Try to use gravity
instead of layout_gravity
.
Because you set orientation
to horizontal, which means you cannot manually change horizontal position of your child views.
I have found 2 solutions to that:
- Set
android:orientation="vertical"
. - Use
FrameLayout
instead ofLinearLayout
as the parent for your text/checkbox widgets. It is not primary usage ofFrameLayout
but that advice is also noted in Android documentation:... You can, however, add multiple children to a FrameLayout and control their position within the FrameLayout by assigning gravity to each child, using the android:layout_gravity attribute.