Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify android:listSelector="@null" programmatically?

For some reason, I didn't have extra space around gridview's column borders in emulator but found out that the extra pixels in my real device (Galaxy S). So I would like to try:

android:listSelector="@null" 

programmatically.

I know its related method is setSelector. But what number or id should I give for "@null"? I tried 0 but it made app crash.

UPDATE: I resolved the problem by making my own selector.

like image 722
Tae-Sung Shin Avatar asked Dec 31 '11 02:12

Tae-Sung Shin


2 Answers

Use this:

listView.setSelector(new StateListDrawable());

Will disable the selector :)

like image 91
Richard Avatar answered Oct 21 '22 03:10

Richard


Use

listView.setSelector(android.R.color.transparent);
like image 11
Neyugn Avatar answered Oct 21 '22 04:10

Neyugn