我正在開發我認爲會是一個簡單的列表視圖行佈局,但我有一些麻煩讓我的意見排列正確。在LinearLayout中有4個TextViews都使用layout_weight來適當調整自己的大小。然而,我無法弄清楚的是如何一致地對齊它們,以便每個TextView以與上面和下面相同的位置開始。Android列表視圖行佈局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#AAAAAA88">
<TextView
android:id="@+id/quality"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="2"
android:layout_gravity="center_vertical|right"
android:textColor="#ffffff"
android:padding="5px"
/>
<TextView
android:id="@+id/route_name"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="3"
android:layout_gravity="center_vertical|right"
android:textColor="#ffffff"
android:padding="5px"
/>
<TextView
android:id="@+id/route_grade"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_gravity="center_vertical|right"
android:textColor="#ffffff"
android:padding="5px"
/>
<TextView
android:id="@+id/route_distance"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_gravity="center_vertical|right"
android:textColor="#ffffff"
android:padding="2px"
/>
</LinearLayout>
我使用的嘗試:重力標籤似乎不工作。 LinearLayout在這裏是錯誤的方法嗎?
作爲一個編輯,我正在使用特定的寬度值進行一些調整。現在來測試它是否在不同屏幕上顯示相同。