2012-11-16 55 views
-1

我有一些佈局問題,不知道如何解決它。設置垂直線的高度

這裏是我的佈局(排列的RelativeLayout):http://goo.gl/GxFTq

可見的黑線在我的XML創建像

<View android:background="#000000" 
     android:layout_width = "fill_parent" 
     android:layout_below="@+id/lblCaption" 
     android:id="@+id/view0" 
     android:layout_centerHorizontal="true" 
     android:layout_height="2dp"/> 

我加入了紅色和綠色的線,GIMP來形容我的問題。 右側的水平線應位於顯示屏頂部和底部垂直線的中間。 應該像

android:layout_centerHorizontal="true" + distance between the top of the display to vertical line on top 

(見我的照片綠線)

任何提示嗎? (XML或編程可能的解決方案 - 無所謂)

回答

1

嘗試這個新代碼

<View 
android:id="@+id/view0" 
android:layout_width="2dp" 
android:layout_height="50dp" 
android:layout_below="@+id/lblCaption" 
android:background="#000000" /> 
+0

哈! :)你的第一個代碼給了我同樣的想法。我用android:layout_width =「0dp」創建了一個「隱形」視圖。謝謝 :) – Prexx