Set background color for an item in list view which is rounded border
<p>I used rounded border layout to set as the background for my listview.
However, when I set background color for each item in listview, color is override into the border. Does anyone know how to solve this problem.</p>

<p>Please help me.
Thanks,
Ankata</p>

<p>====================== My code ==============</p>

<p>border_rounded.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;shape xmlns:android="http://schemas.android.com/apk/res/android" &gt;
    &lt;stroke android:width="1dp"
        android:color="#B1BCBE"&gt;&lt;/stroke&gt;
&lt;solid android:color="#00000000"&gt;&lt;/solid&gt;
&lt;corners android:radius="20px"/&gt;
&lt;/shape&gt;
</code></pre>

<p>item.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/p60001_layout_info"
android:layout_width="match_parent"
android:layout_height="30dp" &gt;

&lt;TextView
    android:id="@+id/p60001_item_info"
    android:layout_width="wrap_content"
    android:layout_height="30dp"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:text="AAAA"
    android:textSize="15dp" android:layout_marginLeft="10dp" android:fadeScrollbars="false" android:textColor="@color/txt_normal" android:scrollHorizontally="true" android:gravity="center_vertical"&gt;
&lt;/TextView&gt;
&lt;/RelativeLayout&gt;
</code></pre>

<p>main.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back_ground"
android:orientation="vertical" xmlns:android1="http://schemas.android.com/apk/res/android"&gt;

&lt;ScrollView android:id="@+id/ScrollView01"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"&gt;

    &lt;LinearLayout
        android:id="@+id/LinearLayout02"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" &gt;

        &lt;ListView
            android1:id="@+id/p60001_friend_panel"
            android1:layout_width="match_parent"
            android1:layout_height="62dp"
            android1:layout_marginBottom="5dp"
            android1:layout_marginLeft="10dp"
            android1:layout_marginRight="10dp"
            android1:layout_weight="0.22"
            android:background="@drawable/border_rounded" android1:scrollbars="none" android1:scrollbarAlwaysDrawVerticalTrack="false"&gt;

        &lt;/ListView&gt;

    &lt;/LinearLayout&gt;

&lt;/ScrollView&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>Adapter:</p>

<pre><code>public View getView(int position, View convertView, ViewGroup parent) {
    View vi=convertView;
    if(convertView==null)
        vi = inflater.inflate(R.layout.p60001_user_info, null);

    // Get component of list view
    RelativeLayout root = (RelativeLayout) vi.findViewById(R.id.p60001_layout_info);

    // Set background
    if (position % 2 == 0){
        root.setBackgroundColor(R.color.color_fist_in_pack_view);
    }else{
        root.setBackgroundColor(0xF0EED7);
    }

    return vi;
}
</code></pre>
