allenskd allenskd -3 years ago 167
Android Question

ListView: disabling clicking/focus

I added a header view to my ListView and it's working quite well, the problem I'm having right now is that I need to remove the default clicking/focus effect when I click the header.

Apart from that, is it possible to also remove the click/focus effect to some items when they are "disabled" options?

Answer Source

Of course you can do this! For header or footer views you can just call addHeaderView (View v, Object data, boolean isSelectable) or addFooterView (View v, Object data, boolean isSelectable) respectively with isSelectable == false.

For regular list items you may just return false for the boolean isEnabled (int position) method. :-)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download