Android List View , how to give a border and a background color to individual items in android list
<p>I have created an android list and I want to give a border color to individual list items by checking a variable value and color the background according to the value. This is my work  so far .</p>

<p>The layout</p>

<pre><code>    &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:tools="http://schemas.android.com/tools"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:paddingBottom="@dimen/activity_vertical_margin"
       android:paddingLeft="@dimen/activity_horizontal_margin"
       android:paddingRight="@dimen/activity_horizontal_margin"
       android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" &gt;

       &lt;ListView
          android:id="@+id/android:myalertlist"
          android:layout_width="250dp"
           android:layout_height="wrap_content"
          android:choiceMode="singleChoice"
          android:clickable="true"
         android:background="@drawable/border_ui"
         android:drawSelectorOnTop="false" &gt;
        &lt;/ListView&gt;

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

<h1>My list view</h1>

<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:orientation="vertical" &gt;

   &lt;TextView
       android:id="@+id/txtOne"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textIsSelectable="false" /&gt;

    &lt;TextView
       android:id="@+id/txtTwo"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:textIsSelectable="false" /&gt;



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

<h1>@drawable/border_ui declaration</h1>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
 &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"       android:shape="rectangle" &gt;
</code></pre>

<p>
    -->
   
   
   
        </p>

<p>Activity Java Code</p>

<p>package test.application;</p>

<pre><code>     public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    HashMap&lt;String, String&gt; hashMapOne = new HashMap&lt;String, String&gt;();
    hashMapOne.put("KEYONE", "EXPORT");
    hashMapOne.put("KEY_TWO", "A");

    HashMap&lt;String, String&gt; hashMapTwo = new HashMap&lt;String, String&gt;();
    hashMapTwo.put("KEYONE", "IMPORT");
    hashMapTwo.put("KEY_TWO", "B");

    HashMap&lt;String, String&gt; hashMapThree = new HashMap&lt;String, String&gt;();
    hashMapThree.put("KEYONE", "IMPORT");
    hashMapThree.put("KEY_TWO", "C");


    HashMap&lt;String, String&gt; hashMapFour = new HashMap&lt;String, String&gt;();
    hashMapFour.put("KEYONE", "EXPORT");
    hashMapFour.put("KEY_TWO", "C");

    ArrayList&lt;HashMap&lt;String, String&gt;&gt; hashList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();

    hashList.add(hashMapOne);
    hashList.add(hashMapTwo);
    hashList.add(hashMapThree);
    hashList.add(hashMapFour);

    setContentView(R.layout.activity_main);
    SimpleAdapter simpleAdapter = new SimpleAdapter(MainActivity.this, hashList,
            R.layout.list_test, new String[] { "KEYONE",
                    "KEY_TWO" }, new int[] { R.id.txtOne,
                    R.id.txtTwo });

    final ListView lv = (ListView) findViewById(R.id.android_myalertlist);
    lv.setAdapter(simpleAdapter);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

  }
</code></pre>

<p>I still have a no clue to highlight and color the individual items. If anyone can guide me I would be thankful. <img src="http://i.stack.imgur.com/V5ijW.png" alt="enter image description here"></p>
