I have a ListView
set in my AlertDialog
in Android and i'm trying to add separators as heading titles to help organize the information. I figured out how to display them... but they are still selectable by the user which isn't good.
Is there a way to disable an item to be selectable in an Android ListView
? I found an method isEnabled(int position)
to see if an item is enabled or not but none to see if its disabled.
Just Now i have implemented it
ListView list=new ListView(this);
list.getChildAt(0).setEnabled(false);
override this in ur code to disable the focus.
@Override
public boolean isEnabled(int position) {
return false;
}
I've found a lot of comments saying that
setEnabled(false)
setClickable(false)
setFocusable(false)
would work, but the answer is NO
The only workaround for this approach is doing:
view = inflater.inflate(R.layout.row_storage_divider, parent, false);
view.setOnClickListener(null);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With