Most visited

Recently visited

Added in API level 1

AdapterView.OnItemSelectedListener

public static interface AdapterView.OnItemSelectedListener

android.widget.AdapterView.OnItemSelectedListener


在此视图中的项目被选中时调用回调的接口定义。

Summary

Public methods

abstract void onItemSelected(AdapterView<?> parent, View view, int position, long id)

当该视图中的项目被选中时,调用回调方法。

abstract void onNothingSelected(AdapterView<?> parent)

当选择从此视图中消失时,将调用回调方法。

Public methods

onItemSelected

Added in API level 1
void onItemSelected (AdapterView<?> parent, 
                View view, 
                int position, 
                long id)

当该视图中的项目被选中时,调用回调方法。 仅当新选择的职位与之前选定的职位不同或者没有选定的职位时,才会调用此回调。

Impelmenters can call getItemAtPosition(position) if they need to access the data associated with the selected item.

Parameters
parent AdapterView: The AdapterView where the selection happened
view View: The view within the AdapterView that was clicked
position int: The position of the view in the adapter
id long: The row id of the item that is selected

onNothingSelected

Added in API level 1
void onNothingSelected (AdapterView<?> parent)

当选择从此视图中消失时,将调用回调方法。 例如,当触摸被激活或者适配器变空时,选择可以消失。

Parameters
parent AdapterView: The AdapterView that now contains no selected item.

Hooray!