mardi 2 août 2016

How can I align checkbox with text to right side of the screen?

I have a checkbox inside a TableRow. I would like to align both checkbox and text to the right side of the screen but when I use android:gravity="right" it only aligns the text to the right side of the screen but not the square (the checkbox itself). It seems that they are aligned separately (checkbox on the left and text on the right side of the screen).

Here is the snippet of xml that refers to the checkbox:

<TableRow android:layout_height="wrap_content"
          android:layout_width="match_parent"
          android:layout_marginBottom="10dp">

          <CheckBox
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Select"
                android:id="@+id/checkboxSelect"
                android:layout_column="0"
                android:layout_weight="1"
                android:gravity="right"/>
</TableRow>

How can I align both the checkbox and the text on it to the right side of the screen?

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire