Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ListView: disabling clicking/focus

Tags:

java

android

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?

like image 552
allenskd Avatar asked Nov 25 '10 17:11

allenskd


2 Answers

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. :-)

like image 189
mreichelt Avatar answered Nov 01 '22 18:11

mreichelt


I solved this by just setting the onClickHandler for the header view to null...worked for me.

like image 31
Evan R. Avatar answered Nov 01 '22 19:11

Evan R.