0

我试图改变文本的对齐方式。这就是我所拥有的:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">

    <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
        <TableRow>
         <TextView
            android:id="@+id/ctime"
            android:layout_gravity="right"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="50"
            android:text="time" />
        </TableRow>
        <TableRow>

           <TextView
               android:id="@+id/cstatus"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:layout_gravity="right"
               android:layout_weight="100"
               android:text="status" />

</TableRow>
</TableLayout>
 </LinearLayout>

即使在设置之后,输出中的所有内容都是左对齐的android:layout_gravity="right"。这是布局的一部分,因为我无法发布整个布局。

4

1 回答 1

3

用这个

android:gravity="right"
于 2012-06-05T20:17:06.590 回答