I want to disable items in a ListView.
First, I tried to use the method isEnabled() from my ArrayAdapter.
But this method is used to make a difference between seperators an normal list view items.
So I tried to disable my items by setting the OnClickListener and OnLongClickListener to NULL in the method getView() of my ArrayAdapter.
This works, but has no graphical effect to the disabled item.
Do I have to set the graphical effect by myself or are there better ways to disable an item in a ListView?
OK, I found the solution for my question: List items are disabled by layout. Simply add
android:clickable="true"(yes,trueis right) to the root node of the layout. To add an graphical effect to the elements of the list item (e.g. TextViews), simply addandroid:enabled="false"to them. At last you have to inflate this “disabled” layout in your list view adapter. That’s all 🙂