views:

263

answers:

2

I'm trying to disable the highlighting of objects in a GridView in Android 2.2. I did find another article saying that I should set the selector to a transparent ColorDrawable, but the views in my GridView are still dimmed when I select them. I'm just using the GridView to display static objects (right now it's text, but I plan on switching it to simple images). None of these objects will be selected. Would it be better to just use a basic view and draw my images manually with quartz?

Thank you for the help!

A: 

Ok, it looks like I found the answer.

In the definition of your Adapter for the GridView, you will have to override the following methods:

public boolean areAllItemsEnabled()
{
    return false;
}

public boolean isEnabled(int position)
{
    return false;
}

This will cause all of the items in your grid to be non-selectable, but it will get rid of the highlight completely.

Kenny
A: 

Just Set v.setOnClickListener(null)

jfleong
This is in your Adapter.getView method
jfleong
I still needed to be able to get click events for the GridView, but I'm sure that would work in other situations.
Kenny