1: The root layout setting of item
Android:clickable="true"
, then the item click event is invalid, and the root layout is setandroid:descendantFocusability="blocksDescendants
", and the checkbox settingsandroid:focusable="false"
None of them will work, so don't set the item root layoutandroid:clickable="true"
Two: item root layout settingsandroid:descendantFocusability="blocksDescendants
", just
beforeDescendants: viewgroup will prioritize its subclass controls to get focus
afterDescendants: Viewgroup only gets focus when its subclass control does not need to get focus
blocksDescendants: viewgroup will override subclass controls and directly get focus
Three: Checkbox settingsandroid:focusable="false"
The above is the reason and solution for checkbox in the item of the listView that the editor introduced to you, which causes the failure of setOnItemClick. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!