【发布时间】:2011-10-16 23:58:38
【问题描述】:
再说一遍:我。
我的“SingleItemAdvancedView”有一个 TableLayout (http://imgur.com/XYdcg),我喜欢怎么称呼它;) 问题是,我想要数据 [没有字符串 *Lbl 作为 android:text 集的 TextViews](所以 NOT 描述如下:“name:”、“id:”等。 ) 显示在整个显示器的右侧,不像现在那样(它们显示在左侧表格列的右侧)。我试图将布局与右侧对齐,以及仅文本(仅使用 layout_gravity 和重力)。一切都没有奏效。我的宽度都设置为 fill_parent ,所以我根本不明白为什么。需要帮助!谢谢!
我的活动 XML 如下所示:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow>
<TextView android:text="@string/idLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView android:text=""
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/itemidv" />
</TableRow>
<TableRow>
<TextView android:text="@string/nameLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView android:text=""
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/namev" />
</TableRow>
<TableRow>
<TextView android:text="@string/amountLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView android:text=""
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/amountv" />
</TableRow>
<TableRow>
<TextView android:text="@string/unitLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView android:text=""
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/unitv" />
</TableRow>
<TableRow>
<TextView android:text="@string/ppuLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView android:text=""
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/ppuv" />
</TableRow>
<TableRow>
<TextView android:text="@string/totalLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView android:text=""
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/totalv" />
</TableRow>
<TableRow>
<TextView android:text="@string/commentLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView android:text=""
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/commentv" />
</TableRow>
<TableRow>
<TextView android:text="@string/enterqrLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView android:text=""
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/qrcodev" />
</TableRow>
<Button android:text="@string/delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/deleteItemBtn"
android:layout_marginTop="20dp"
android:onClick="btnListener" />
</TableLayout>
【问题讨论】:
标签: java android tablelayout alignment