title: CheckedTextView inside ListView: blinking issue upon selection
body: <p>I have a ListView (in single choice mode) containing CheckedTextView items (with no checkmarks) and I have set appropriate selectors to determine the text color and the background color of the currently checked item.</p>
  
  <p>What happens is the following:</p>
  
  <ol>
  <li>I press an item of the ListView: the colors of the "selected" state (black over red) get correctly applied.</li>
  <li>I release the item: it suddenly blinks back to the colors of the "default" state (white over black), for a fraction of a second.</li>
  <li>After the short wrong blinking: the item correctly takes the colors of the "checked" state (black over red, which, by chance, are the same as the "selected" state).</li>
  </ol>
  
  <p>Of course, <strong>I need to get rid of such blinking effect</strong> and I think that this should be fairly easy, but, unfortunately, I can't figure out what am I doing wrong!</p>
  
  <p>Note that the wrong blinking effect only happens on pre-Honeycomb versions of Android (I've checked this both on emulators and physical devices).</p>
  
  <p>I have already searched all over the Web and all over Stack Overflow to find an answer, so please do not address me to existing similar posts (unless they really resolve my issue, of course...).</p>
  
  <p>In the following, you can find all the code needed to reproduce the issue I described above.</p>
  
  <p>The activity (yes, it is a FragmentActivity of the compatibility library, but I really don't think it matters):</p>
  
  <pre class="lang-java prettyprint-override"><code>import android.os.Bundle;
  import android.support.v4.app.FragmentActivity;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  
  public class TempListActivity extends FragmentActivity{
  
  @Override
  protected void onCreate(Bundle icicle) {
      super.onCreate(icicle);
      setContentView(R.layout.temp_list);
  
      ListView listView = (ListView) findViewById(R.id.tempListView);
      String[] array = new String[] { "one", "two", "three" };
      ArrayAdapter&lt;String&gt; arrayAdapter = new ArrayAdapter&lt;String&gt;(this, R.layout.temp_list_item, array);
      listView.setAdapter(arrayAdapter);
  }
  
  }
  </code></pre>
  
  <p>The ListView:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;ListView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/tempListView"
  android:choiceMode="singleChoice"
  android:layout_width="fill_parent" 
  android:layout_height="fill_parent"&gt; 
  &lt;/ListView&gt;
  </code></pre>
  
  <p>The CheckedTextView used as a ListView item:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;CheckedTextView  
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/list_item_title"  
  android:height="?android:attr/listPreferredItemHeight"
  android:textColor="@drawable/list_item_text_custom"
  android:background="@drawable/list_item_custom"
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content" /&gt;
  </code></pre>
  
  <p>The text color selector (list_item_text_custom.xml):</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;selector
  xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;item android:state_checked="true" 
      android:color="#000000"&gt;
  &lt;/item&gt;
  &lt;item android:state_pressed="true"
      android:color="#000000"&gt;
  &lt;/item&gt;
  &lt;item android:state_selected="true"
      android:color="#000000"&gt;
  &lt;/item&gt;
  &lt;item 
      android:color="#ffffff"&gt;
  &lt;/item&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>The background color selector (list_item_custom.xml):</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;selector
  xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;item android:state_checked="true" 
      android:drawable="@drawable/highlighted_item_background"&gt;
  &lt;/item&gt;
  &lt;item android:state_pressed="true"
      android:drawable="@drawable/highlighted_item_background"&gt;
  &lt;/item&gt;
  &lt;item android:state_selected="true"
      android:drawable="@drawable/highlighted_item_background"&gt;
  &lt;/item&gt;
  &lt;item
      android:drawable="@drawable/normal_item_background"&gt;
  &lt;/item&gt;    
  &lt;/selector&gt;
  </code></pre>
  
  <p>The drawable for the highlighted background (highlighted_item_background.xml):</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;shape
  xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;solid android:color="#ff0000" /&gt;    
  &lt;/shape&gt;
  </code></pre>
  
  <p>The drawable for the normal background (normal_item_background.xml):</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;shape
  xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;solid android:color="#000000" /&gt;    
  &lt;/shape&gt;
  </code></pre>
  
  <p>I would really like to leverage the standard Android selectors mechanism instead of being forced to find out some fancy workaround, so if I made any mistake in the code above, please let me know.</p>
  
  <p>Otherwise, any help or alternative solution would be much appreciated.</p>
  
  <p>Thanks in advance.</p>