1
我的listview行有3個文本。我想要做的是垂直對齊所有行文本。我嘗試過使用該行的TableLayout視圖,並將第一個和第三個單元格的寬度設置爲常量。由於移植問題,我不太喜歡使用常量。是否可以不用另一種方式來對齊這些文本?這是佈局:對齊列表視圖中的行文本
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/ingredient_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<com.one2snap.littlechef.android.main.ui.views.AmienneTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ingredient_title" />
</LinearLayout>
使用LinearLayout和weight並沒有幫助。它使用了剩餘空間,而不是絕對空間。所以第二個和第三個文本視圖不能對齊。 – Gratzi 2010-11-09 16:02:58
使用LinearLayout和權重意味着使用額外的空間,因此它不會創建寬度相等的視圖。 – Gratzi 2010-11-10 07:35:37
我必須說,我很驚訝沒有關於如何做這種事情的更多輸入。在我的工作中,我遇到了很多情況,我需要以整潔的表格格式顯示數據行,但是您會認爲沒有人會在Android設備上執行這些操作,以我能夠發現的文獻數量來判斷。 – rushinge 2011-03-02 00:55:50