Search code examples
androidlistviewhighlightingandroid-arrayadapter

Android: How to disable ListView?


I have a list view and want each cell in my within it to be disabled so that when you tap on it the text colors stay the same.

But I want it to be scrollable.

How can I achieve this?


Solution

  • This similar post might be of help. The general approach is to disable all the items instead of the whole view. Essentially:

    • Inherit from ArrayAdapter (or any other adapter)
    • Override isEnabled(int position) to return false
    • Override areAllItemsEnabled() to return false