如何在相对布局中的图像视图上方添加水平 1px 线? [英] How to add a horizontal 1px line above image view in a relative layout?
本文介绍了如何在相对布局中的图像视图上方添加水平 1px 线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在相对布局中的图像视图上方添加水平 1px 白线?
How do I add a horizontal 1px white line above image view in a relative layout?
<RelativeLayout
android:id="@+id/widget38"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="108px"
android:layout_y="87px"
>
<ImageView
android:id="@+id/widget39"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
>
</ImageView>
</RelativeLayout>
推荐答案
只需在您的 XML 中您想要的任何位置添加以下行.
Just add the following line in your XML where ever you want it.
<View android:background="#ffffff"
android:layout_width = "match_parent"
android:layout_height="1dp"/>
试试这个:
<RelativeLayout
android:id="@+id/widget38"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="108px"
android:layout_y="87px"
>
<View android:id="@+id/separator"
android:background="#ffffff"
android:layout_width = "fill_parent"
android:layout_height="1dip"
android:layout_centerVertical ="true"
android:layout_alignParentTop="true"/>
<ImageView
android:id="@+id/widget39"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/separator"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
这篇关于如何在相对布局中的图像视图上方添加水平 1px 线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文