问题
I want to disable the Selector from my ListView. That's when I click any items there will be no indication that it has been clicked.
I tried this in my ListView tag:
android:listSelector="@null" and didn't work
回答1:
set this android:listSelector="#00000000" Try this.
回答2:
The above answer from Kalpana is correct. You can also do it in code like this:-
myListView.setSelector(new ColorDrawable(0x0));
回答3:
You could create a new drawable to use as selector, that wouldn't have any state in it :
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/background_dark" />
</selector>
and then set it using the android:listSelector attribute. You can reference one of the android colors as the background color in your selector : http://developer.android.com/reference/android/R.color.html
回答4:
mListView.setSelector(new StateListDrawable());
来源:https://stackoverflow.com/questions/6633374/android-listview-selector-set-to-null