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:

  1. Set android:orientation="vertical".
  2. Use FrameLayout instead of LinearLayout as the parent for your text/checkbox widgets. It is not primary usage of FrameLayout 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.