Search code examples
androidlistviewonclicklistener

Listview Item only clickable after scrolling


I have a listview with a custom adapter. Everything populates correctly, however, I can only click on a listview item if i scroll the listview up and down. I've tried a bunch of SO answers, but nothing so far has worked, any help would be appreciated.


Solution

  • How do you set the click listener? Do you use listView.setOnItemClickListener(...) or use some view.setOnClickListener() inside the adapter? It seems you use the second approach and set the listener only after the views are reused (using convertView), not immediately after they're inflated. If that's the case check and update the conditions inside the getView() method of the adapter.