我有一個ListView,它包含一個使用RelativeLayout的兩個垂直定向TextView左邊的圖像。當兩個TextView都有文字時,看起來很好。有時底部的TextView將沒有任何文本,問題是整個佈局的位置應該高於幾個像素,因爲它仍然爲文本保留空間,因爲沒有任何使整個列表變得惱人的空白差距。我記得看到一個例子,有人做了佈局不保留空間,但我不記得他是如何做到的。有人請賜教嗎?android RelativeLayout,當TextView下面沒有文字時,試圖垂直居中TextView
0
A
回答
0
+0
這是一個鏈接到羅曼蓋伊的解釋在這個 http ://www.curious-creature.org/2009/02/22/android-layout-tricks-1/ – Rasmus 2010-07-14 21:37:43
可能需要爲RelativeLayout設置左側的'gravity'。 – Pentium10 2010-07-14 20:35:03
看看[android:layout_alignWithParentIfMissing](http://developer.android.com/reference/android/widget/RelativeLayout.LayoutParams.html#attr_android:layout_alignWithParentIfMissing) – fedj 2010-08-12 12:06:18