1

I have this android layout xml:

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

   <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#70a5b3" 
        android:layout_above="@+id/skipIcon"/>

    <com.m.view.text.MyTextView
        style="@style/textOnBg"
        android:layout_toLeftOf="@+id/skipIcon"
        android:text="Skip"
        android:textStyle="normal" />

    <ImageView
        android:id="@id/skipIcon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/signup_skip_icon" />
</RelativeLayout>

and I want to create this layout

enter image description here

but my xml doesn't show the border line. How can I fix this?

Elad Benda2
  • 13,852
  • 29
  • 82
  • 157

3 Answers3

2
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <View
        android:id="@+id/border_line"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_alignParentTop="true"
    android:background="#70a5b3" />

    <com.m.view.text.MyTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@+id/skipIcon"
        android:text="Skip"
        android:textStyle="normal" />

    <ImageView
        android:id="@id/skipIcon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_below="@+id/border_line"
        android:src="@drawable/signup_skip_icon" />
</RelativeLayout>
AabidMulani
  • 2,325
  • 1
  • 28
  • 47
  • super! but why `android:layout_alignParentTop="true"` worked and `android:layout_above="@+id/skipIcon"` didn't? – Elad Benda2 Dec 18 '13 at 07:18
  • what happens when I don't add `android:layout_height="wrap_content"` to `TextView`? – Elad Benda2 Dec 18 '13 at 07:19
  • 1
    TextView always need a height and width parameters! {eclipse will prompt a error}. And i don't have an answer for ur first question, i had the same issue once, and it worked this way for me! ;-) – AabidMulani Dec 18 '13 at 07:26
0

try padding of 1dp in your relative layout.

AabidMulani
  • 2,325
  • 1
  • 28
  • 47
0

Try this:

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<View
    android:id="@+id/line"
    android:layout_width="match_parent"
    android:layout_height="1dp"
    android:background="#70a5b3"/>

<ImageView
    android:id="@+id/skipIcon"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_below="@id/line"
    android:src="@drawable/signup_skip_icon" />

<com.waze.view.text.WazeTextView
    style="@style/textOnBg"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/line"
    android:layout_toLeftOf="@id/skipIcon"
    android:text="Skip"
    android:textStyle="normal"/>

</RelativeLayout>
LL520
  • 159
  • 3