Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: disabling highlight on listView click

I want to disable the orange highlight that occurs when touching a listView row. So far in my xml I have tried the following:

android:focusable="false" android:focusableInTouchMode="false" android:clickable="false" 

More information: I want there to be zero difference when a user touches the screen on this listView object.

like image 495
John Moffitt Avatar asked May 25 '10 18:05

John Moffitt


2 Answers

Add this to your xml:

android:listSelector="@android:color/transparent" 

And for the problem this may work (I'm not sure and I don't know if there are better solutions):

You could apply a ColorStateList to your TextView.

like image 142
RoflcoptrException Avatar answered Oct 11 '22 14:10

RoflcoptrException


RoflcoptrException's answer should do the trick,but for some reason it did not work for me, So I am posting the solution which worked for me, hope it helps someone

<ListView  android:listSelector="@android:color/transparent"  android:cacheColorHint="@android:color/transparent" /> 
like image 45
Mushtaq Jameel Avatar answered Oct 11 '22 12:10

Mushtaq Jameel