Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android GridView Background Highlights

Normally in the Gridview, while you are pressing on an element in the grid, it highlights the specific squares background with a nice orange'ish well defined. I want to make it stay highlighted after you let go as well, basically turn it into a toggle on/off for the highlights. I want to use the android highlight color that's built in automatically but I have so far been unsuccessful in any attempt to get this to work. Any help would be greatly appreciated.

Thanks!

like image 407
user522696 Avatar asked Feb 26 '23 17:02

user522696


2 Answers

Use android:listSelector="#00000000" in your GridView element in your XML layout file.

like image 191
peter_feng Avatar answered Mar 08 '23 17:03

peter_feng


Try setting

setDrawSelectorOnTop(true)

This draws selector over the selected item.

like image 28
Raunak Avatar answered Mar 08 '23 18:03

Raunak