2012-11-16 32 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