Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It depends somewhat on what you are looking to accomplish...</p> <p>If you are looking to display a third background type when the user has two fingers down, there is no drawable state that you can reference directly to accomplish. You would have to co-op one of the existing states that is not often used in touch mode (such as the selected state), and implement a custom touch handler on the list item's object to set that state. For example, implement <code>onTouchEvent()</code> in each list item's view (or add an <code>onTouchListener()</code> if you don't have a custom class), look for the <code>ACTION_POINTER_DOWN</code> event to tell you that a second finger came down, and call <code>setSelected()</code> on the view to trigger a drawable you have set for the <code>android:state_selected</code> in your <code>&lt;selector&gt;</code>.</p> <p>If you just want the state to clear under this case, you can cancel the touch event when more than one finger is detected. In this case, you are looking at customizing the <code>ListView.onInterceptTouchEvent()</code> method to look for the <code>ACTION_PONTER_DOWN</code> event and return <code>true</code>. This will teach the <code>ListView</code> to steal the touch back from it's child item with a second finger, which will cancel the pressed state of the list item. Make sure to call back through to <code>super</code> in this case so you don't break all the existing logic <code>ListView</code> uses for scrolling, etc.</p> <p>Beware of cases where the existing <code>AbsListView</code> implementation may get in your way here. For example, the current implementation of <code>onIntercepTouchEvent()</code> looks for <code>ACTION_POINTER_UP</code> in order to switch the main touch finger from the first to the second. This behavior may cause strange artifacts in your customization if you aren't aware of it.</p> <p>HTH.</p>
    singulars
    1. This table or related slice is empty.
    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.
    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