Skip to content Skip to sidebar Skip to footer

Right Aligning Text In Android?

Is there anything special I need to do to get text right aligned in a ? The following simple example seems to align the text right-edged on the center of the scr

Solution 1:

Fixed.

Removed Portion from TextView :

android:layout_gravity="right"android:layout_span="2"

Updated Portion in TextView:

android:gravity="right"android:layout_weight="1.0"


 <TableLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_height="fill_parent"android:layout_width="fill_parent" >

      <TableRow><TextViewandroid:text="Some text"android:layout_width="wrap_content"android:layout_height="wrap_content"android:gravity="right"android:layout_weight="1.0" /></TableRow><TableRow><Buttonandroid:text="Button 1"android:layout_weight="50"/><Buttonandroid:text="Button 2"android:layout_weight="50"/></TableRow>
 </TableLayout>

Post a Comment for "Right Aligning Text In Android?"