鸿蒙OS开发文档 鸿蒙OS ListContainer.ItemSelectedListener

2024-02-25 开发教程 鸿蒙OS开发文档 匿名 0

ListContainer.ItemSelectedListener

public static interface ListContainer.ItemSelectedListener

侦听 ListContainer 对象中组件项的选定事件。 通过调用 onItemSelected 处理选定的事件。

方法总结

修饰符和类型方法描述
voidonItemSelected(ListContainer parent, Component component, int position, long id)选择 ListContainer 对象中的组件项时调用。

方法详情

onItemSelected

void onItemSelected(ListContainer parent, Component component, int position, long id)

选择 ListContainer 对象中的组件项时调用。

此回调在以下情况下处理选定事件:

  1. ListContainer 对象中没有项目被选中。
  2. ListContainer 对象中的另一个组件项被选中。

参数:

参数名称参数描述
parent指示具有选定组件项的 ListContainer 对象。
component指示 ListContainer 对象中的选定组件项。
position指示所选组件项在 ListContainer 对象中的位置。
id表示所选组件项的行 ID。