OnItemCLickLIstener doesn't work on ListView

前端 未结 3 1047
余生分开走
余生分开走 2021-01-26 02:44

I have an activity with a ListView. ListView with custom views. I add OnItemClickLIstener to the ListView. and when i click on item, in result i see nothing. Activity with ListV

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-26 03:27

    By setting focusable objects in your row layout, you are preventing the ListView from getting the touch event.

    This FrameLayout is consuming the touch event:

    
    

    Remove the focusable settings so it looks like this:

    
    

    (You really should organize your XML so that is is readable, in Eclipse use Ctrl+Shift+F.)

提交回复
热议问题