Search code examples
androidandroid-layoutandroid-listviewandroid-custom-view

Custom Layouts for ListView Breaks OnItemClickListener


When using a custom layout for an item in listview, it turns out that OnItemClickListener does not fire.

Previously, I was using android.R.layout.two_line_list_item. All I did was swap out this deprecated layout for my own custom layout.

I have tried:

-setting the choice mode to single

-enabling long and short clickability in the parent list and list items

-enabling focus and descendant focusability

-requesting focus

Any Feedback would be greatly appreciated!!!

Thank you!


Solution

  • I am guessing you can try setting android:clickable="true" in the customlayout's xml file. But the code of your layout file could be more helpful.