androidxml-layout

Layout overwriting


I have an arrow image in listview on right hand side. The text from other holders is overwriting on it. How can i keep a gap or space between arrow and justify all text. I was looking to configure it as no text should be aligned over arrow.

Code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/list_selector"
    android:orientation="horizontal"
    android:padding="10dip" >

    <!--  ListRow Left sied Thumbnail image -->
    <LinearLayout android:id="@+id/thumbnail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:background="@drawable/image_bg"
        android:layout_marginRight="5dip">

        <ImageView
            android:id="@+id/ivImage"
            android:layout_width="50dip"
            android:layout_height="50dip"
            android:src="@drawable/ic_launcher"/>

    </LinearLayout>

    <!-- Title Of Song-->
    <TextView
        android:id="@+id/tvName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/thumbnail"
        android:layout_toRightOf="@+id/thumbnail"
        android:text="Title"
        android:textColor="#040404"
        android:typeface="sans"
        android:textSize="15dip"
        android:textStyle="bold"/>

    <!-- Artist Name -->
    <TextView
        android:id="@+id/tvDateOfBirth"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/tvName"
        android:textColor="#343434"
        android:textSize="10dip"
        android:layout_marginTop="1dip"
        android:layout_toRightOf="@+id/thumbnail"
        android:text="Author" />

    <!-- Artist Name -->
    <TextView
        android:id="@+id/tvDescription"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/tvDateOfBirth"
        android:textColor="#343434"
        android:textSize="10dip"
        android:layout_marginTop="1dip"
        android:layout_toRightOf="@+id/thumbnail"
        android:text="Description" />

    <!-- Artist Name -->
    <TextView
        android:id="@+id/tvHeight"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/tvName"
        android:textColor="#343434"
        android:textSize="10dip"
        android:layout_marginTop="1dip"
        android:layout_toRightOf="@+id/tvDateOfBirth"
        android:text="publishedAt" />


    <!-- Rightend Arrow -->
    <ImageView android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/arrow"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"/>

</RelativeLayout>

Solution

  • try this one.

     <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/list_selector"
        android:orientation="horizontal"
        android:padding="10dip" >
    
        <!--  ListRow Left sied Thumbnail image -->
        <LinearLayout android:id="@+id/thumbnail"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:background="@drawable/image_bg"
            android:layout_marginRight="5dip">
    
            <ImageView
                android:id="@+id/ivImage"
                android:layout_width="50dip"
                android:layout_height="50dip"
                android:src="@drawable/ic_launcher"/>
    
        </LinearLayout>
    
        <!-- Title Of Song-->
        <TextView
            android:id="@+id/tvName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/thumbnail"
            android:layout_toRightOf="@+id/thumbnail"
            android:text="Title"
            android:textColor="#040404"
            android:typeface="sans"
            android:textSize="15dip"
            android:textStyle="bold"/>
    
        <!-- Artist Name -->
        <TextView
            android:id="@+id/tvDateOfBirth"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/tvName"
            android:textColor="#343434"
            android:textSize="10dip"
            android:layout_marginTop="1dip"
            android:layout_toRightOf="@+id/thumbnail"
            android:text="Author" />
    
        <!-- Artist Name -->
        <TextView
            android:id="@+id/tvDescription"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/tvDateOfBirth"
            android:textColor="#343434"
            android:textSize="10dip"
            android:layout_marginTop="1dip"
            android:layout_toLeftOf="@+id/imgright"
            android:layout_toRightOf="@+id/thumbnail"
            android:text="Description" />
    
        <!-- Artist Name -->
        <TextView
            android:id="@+id/tvHeight"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/tvName"
            android:textColor="#343434"
            android:textSize="10dip"
            android:layout_marginTop="1dip"
            android:layout_toLeftOf="@+id/imgright"
            android:layout_toRightOf="@+id/tvDateOfBirth"
            android:text="publishedAt" />
    
    
        <!-- Rightend Arrow -->
        <ImageView android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imgright"
            android:src="@drawable/arrow"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"/>
    
    </RelativeLayout>