setOnItemClickListener VS setOnItemSelectedListener in ListView.

后端 未结 5 431
隐瞒了意图╮
隐瞒了意图╮ 2021-01-04 05:20

I wish to set an onClickListener on items of a ListView but I see two methods setOnItemClickListener and setOnItemSelectedListener . I didint find

5条回答
  •  猫巷女王i
    2021-01-04 05:24

    Not necessarily true. You can have a ListView that will be navigable with the keyboard or accelerometer. Also clicking an item doesn't need to mean selecting it - maybe after selecting something once you want to block selection until some other event happens.

    For all purposes if you want to react to a selection of an item use the setOnItemSelectedListener but if you want to react to the user clicking on them go with setOnItemClickListener.

提交回复
热议问题