设置垂直线的高度

时间:2012-11-16 12:29:41

标签: android layout

我有一些布局问题,不知道如何解决它。

这是我的布局(在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 个答案:

答案 0 :(得分:1)

尝试此新代码

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