0

Here is the XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="@android:color/transparent"
    android:minHeight="40dp" >

    <LinearLayout
        android:id="@+id/contentLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/separatorView"
        android:weightSum="3"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/itemTitleLabel"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@null"
            android:gravity="right"
            android:lines="0"
            android:paddingBottom="5dp"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"
            android:paddingTop="5dp"
            android:textColor="@android:color/black"
            android:textSize="16sp"
            android:textStyle="bold" />

        <RelativeLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="2"
            android:background="@android:color/white" >

            <TextView
                android:id="@+id/itemDetailsLabel"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:background="@null"
                android:gravity="left"
                android:lines="0"
                android:paddingBottom="5dp"
                android:paddingLeft="5dp"
                android:paddingRight="5dp"
                android:paddingTop="5dp"
                android:textColor="@android:color/black"
                android:textSize="16sp"
                android:textStyle="normal" />

            <ImageView
                android:id="@+id/itemAvailabilityImageView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:background="@null"
                android:paddingBottom="5dp"
                android:paddingLeft="5dp"
                android:paddingRight="5dp"
                android:paddingTop="5dp"
                android:scaleType="centerInside" />
        </RelativeLayout>
    </LinearLayout>

    <View
        android:id="@+id/separatorView"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_alignParentBottom="true"
        android:background="@color/tab_bar_separator" />

</RelativeLayout>

This is a row layout in a list view. What's shown is the last view only. The one with the id = separatorView.

Update:

enter image description here

Abdalrahman Shatou
  • 4,550
  • 6
  • 50
  • 79

2 Answers2

0

You should specify in your last View element (The separator)

android:layout_below="@id/ContentLayout"

To make sure the separatoe won't be aligned to the top of the RelativeLayout.

ElyashivLavi
  • 1,681
  • 3
  • 22
  • 33
-1

Hope this helps,if i got your question right:

<View
    android:layout_width="match_parent"
    android:layout_height="2dp"
    android:background="#000000" />

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

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Keyboard" />

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/ic_launcher" />
</LinearLayout>

<View
    android:layout_width="match_parent"
    android:layout_height="2dp"
    android:background="#000000" />

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

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Flash" />

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/ic_launcher" />
</LinearLayout>

<View
    android:layout_width="match_parent"
    android:layout_height="2dp"
    android:background="#000000" />

Rishabh Srivastava
  • 3,683
  • 2
  • 30
  • 58
  • You are drawing two rows in one XML. Also, I want the left hand side to have a fixed width as well as the right hand side view. This solution doesn't work – Abdalrahman Shatou Nov 19 '13 at 10:27
  • check it now...you know your question is not clear that exactly what do u want to implement. – Rishabh Srivastava Nov 19 '13 at 10:40
  • Your layout is missing a lot of things. Where is the orientation of the layout. Why there are two images while only one exists at row. The position of elements is not correct. – Abdalrahman Shatou Nov 19 '13 at 17:40
  • See what ever I saw in your layout,I gave you the code for that. Frankly speaking I din't get your question,what are you trying to say/implement. – Rishabh Srivastava Nov 20 '13 at 03:54