How To Add A Horizontal 1px Line Above Image View In A Relative Layout?
How do I add a horizontal 1px white line above image view in a relative layout?
Solution 1:
Just add the following line in your XML where ever you want it.
<Viewandroid:background="#ffffff"android:layout_width = "match_parent"android:layout_height="1dp"/>
Edit: Try this:
<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>
Solution 2:
Consider moving the layout for the line into a separate file:
<!-- horizontal_line.xml --><?xml version="1.0" encoding="utf-8"?><Viewstyle="@style/HorizontalLine" />
... referencing a custom style definition:
<!-- styles.xml --><stylename="HorizontalLine"><itemname="android:layout_width">fill_parent</item><itemname="android:layout_height">@dimen/horizontal_line_height</item><itemname="android:background">@color/horizontal_line_fill_color</item><itemname="android:layout_marginTop">@dimen/large_spacer</item><itemname="android:layout_marginBottom">@dimen/large_spacer</item></style>
... and then you can include
it in your layout:
<RelativeLayoutandroid:id="@+id/widget38"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_x="108px"android:layout_y="87px" ><includeandroid:id="@+id/horizontal_line"layout="@layout/horizontal_line" /><ImageViewandroid:id="@+id/widget39"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@id/horizontal_line"android:layout_alignParentTop="true"android:layout_alignParentRight="true" /></RelativeLayout>
Post a Comment for "How To Add A Horizontal 1px Line Above Image View In A Relative Layout?"