Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just create a drawable that has a transparent color in it, something like this:</p> <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_window_focused="false" android:drawable="@android:color/transparent"/&gt; &lt;!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. --&gt; &lt;item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_disabled_holo_light" /&gt; &lt;item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_disabled_holo_light" /&gt; &lt;item android:state_focused="true" android:state_pressed="true" android:drawable="@color/transparent" /&gt; &lt;item android:state_focused="false" android:state_pressed="true" android:drawable="@color/transparent" /&gt; &lt;item android:state_focused="true" android:drawable="@drawable/list_focused_holo" /&gt; &lt;/selector&gt; </code></pre> <p>And then set by code or by XML:</p> <pre><code>listView.setSelector(R.drawable.my_transparent_selector); </code></pre> <p>The javadoc for this method says:</p> <blockquote> <p>Set a Drawable that should be used to highlight the currently selected item.</p> </blockquote> <p>and the XML attribute is:</p> <blockquote> <p>android:listSelector</p> </blockquote> <p>You can play with all the states, remember that you also have the focus state.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload