title: Android listview select default item
body: <p>I am trying to highlight by default a position in my listview. </p>
  
  <p>Here is the code:
  My listview declaration:</p>
  
  <pre><code>&lt;ListView
  android:id="@+id/list"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"/&gt;
  </code></pre>
  
  <p>Item list declaration</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="wrap_content"
  android:orientation="vertical" &gt;
  
  &lt;TextView
      android:id="@+id/text"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:paddingLeft="10dip"
      android:textSize="20sp"
       android:textStyle="bold" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>In my custom selector I have: </p>
  
  <pre><code>   &lt;item 
      android:drawable="@android:color/holo_green_light" 
      android:state_selected="true"/&gt;
  </code></pre>
  
  <p>And now I want to mark with green by default a position in my listview.
  Java code:</p>
  
  <pre><code>listview.setSelector(R.drawable.listselector);
  listview.setSelection(20);
  </code></pre>
  
  <p>But the selected element is not highlighted with the green color. I tried lot of proposed solutions found, but nothing worked.
  Any ideas? 
  Thanks in advance.</p>