Difference between onItemClickListener and OnItemSelectedListener of AdapterView

后端 未结 3 1802
情书的邮戳
情书的邮戳 2021-01-31 14:34

What is the difference between these two listeners,documentation says :

OnItemSelectedListener - Interface definition for a callback to be invoked when an item in this v

3条回答
  •  太阳男子
    2021-01-31 15:16

    Android makes a distinction between selection events and click events. Widgets based off of the “spinner” paradigm — including Spinner and Gallery — treat everything as selection events. Other widgets — like ListView and GridView — treat selection events and click events differently. For these widgets, selection events are driven by the pointing device, such as using arrow keys to move a highlight bar up and down a list. Click events are when the user either “clicks” the pointing device (e.g., presses the center D-pad button) or taps on something in the widget using the touchscreen.

    (source: Excerpt from "The Busy Coder's Guide to Android Development" Version 3.8)

提交回复
热议问题