鸿蒙OS开发文档 第32页

鸿蒙OS ListContainer.ItemSelectedListener

ListContainer.ItemSelectedListener public static interface ListContainer.ItemSelectedListener 侦听 ListContainer 对象中组件项的选定事件。 通过调用 onItemSelected 处理选定的事件。 方法总结 修饰符和类型 方法 描述 void onItemSelected(ListContainer parent, Component component, int position, long id) 选择 ListContainer 对象中的组件项时调用。 方法详情 onItemSelected void onItemSelected(ListContainer parent, Component component, int position, long id) 选择 ListContainer 对象中的组件项时调用。 此回调在以下情况下处理选定事件: ListContainer 对象中没有项目被选中。 ListContainer 对象中的另一个组件项被选中。 参数: 参数名称 参数描述 parent 指示具有选定组件项的 ListContainer 对象。 component 指示 ListContainer 对象中的选定组件项。 position 指示所选组件项在 ListContainer 对象中的位置。 id 表示所选组件项的行 ID。

鸿蒙OS ListContainer.ItemLongClickedListener

ListContainer.ItemLongClickedListener public static interface ListContainer.ItemLongClickedListener 提供用于侦听和处理 ListContainer 项的长按事件的侦听器。 此类继承自 ItemLongClickedListener#onItemLongClicked(ListContainer, Component, int, long) 以响应事件。 方法总结 修饰符和类型 方法 描述 boolean onItemLongClicked(ListContainer parent, Component component, int position, long id) 长按 ListContainer 项并处理长按事件时调用。 方法详情 onItemLongClicked boolean onItemLongClicked(ListContainer parent, Component component, int position, long id) 长按 ListContainer 项并处理长按事件时调用。 参数: 参数名称 参数描述 parent 指示 ListContainer 对象。 component 表示 ListContainer 对象中长按的 Component 项。 position 指示长按组件项在 ListContainer 对象中的位置。 id 表示长按项的行ID。 返回: 如果长按事件被处理,则返回 true; 否则返回 false。

鸿蒙OS ListContainer.ItemClickedListener

ListContainer.ItemClickedListener public static interface ListContainer.ItemClickedListener 侦听 ListContainer 项的单击事件。 要响应和处理 ListContainer 项的点击事件,必须实现 onItemClicked。 方法总结 修饰符和类型 方法 描述 void onItemClicked(ListContainer parent, Component component, int position, long id) 单击 ListContainer 实例中的项目并处理单击事件时调用。 方法详情 onItemClicked void onItemClicked(ListContainer parent, Component component, int position, long id) 单击 ListContainer 实例中的项目并处理单击事件时调用。 参数: 参数名称 参数描述 parent 指示具有单击项的 ListContainer 实例。 component 表示 ListContainer 实例中单击的 Component 项。 position 指示 Component 项在 ListContainer 实例中的位置。 该值是一个非负整数。 id 表示被点击项的行ID。

鸿蒙OS ListComponent.OnComponentBoundStatusChangeListener

ListComponent.OnComponentBoundStatusChangeListener public static interface ListComponent.OnComponentBoundStatusChangeListener 实现监听 ListComponent 的状态变化。 方法总结 修饰符和类型 方法 描述 void onChildComponentBoundToWindow(Component component) 当组件绑定到此 ListComponent 时调用。 void onChildComponentUnboundFromWindow(Component component) 当组件与此 ListComponent 解除绑定时调用。 方法详情 onChildComponentBoundToWindow void onChildComponentBoundToWindow(Component component) 当组件绑定到此 ListComponent 时调用。 参数: 参数名称 参数描述 component 表示组件绑定。 onChildComponentUnboundFromWindow void onChildComponentUnboundFromWindow(Component component) 当组件与此 ListComponent 解除绑定时调用。 参数: 参数名称 参数描述 component 表示组件未绑定。

鸿蒙OS ListComponent.CachePolicyListener

ListComponent.CachePolicyListener public static interface ListComponent.CachePolicyListener 实现监听以将组件添加到 ListComponentPool。 方法总结 修饰符和类型 方法 描述 void onCachePolicy(ComponentOwner owner) 回收组件时调用。代码 ListComponent 在清除 ComponentOwner 的内部数据并将组件添加到 ListComponentPool 之前调用此方法。 方法详情 onCachePolicy void onCachePolicy(ComponentOwner owner) 回收组件时调用。代码 ListComponent 在清除 ComponentOwner 的内部数据并将组件添加到 ListComponentPool 之前调用此方法。 参数: 参数名称 参数描述 owner 表示回收组件的 ComponentOwner。

鸿蒙OS ListComponent.BounceBackListener

ListComponent.BounceBackListener public static interface ListComponent.BounceBackListener 实现监听反弹状态的变化,包括反弹开始、反弹进行中、反弹结束。 方法总结 修饰符和类型 方法 描述 void onBounceBackChange(int xOverScrolled, int yOverScrolled) 在反弹过程中调用。 void onBounceBackEnd(int xOverScrolled, int yOverScrolled) 反弹结束时调用。 void onBounceBackStart(int xOverScrolled, int yOverScrolled) 反弹开始时调用。 方法详情 onBounceBackStart void onBounceBackStart(int xOverScrolled, int yOverScrolled) 反弹开始时调用。 参数: 参数名称 参数描述 xOverScrolled 表示水平方向移动的距离。 yOverScrolled 表示垂直方向移动的距离。 onBounceBackChange void onBounceBackChange(int xOverScrolled, int yOverScrolled) 在反弹过程中调用。 参数: 参数名称 参数描述 xOverScrolled 表示水平方向移动的距离。 yOverScrolled 表示垂直方向移动的距离。 onBounceBackEnd void onBounceBackEnd(int xOverScrolled, int yOverScrolled) 反弹结束时调用。 参数: 参数名称 参数描述 xOverScrolled 表示水平方向移动的距离。 yOverScrolled 表示垂直方向移动的距离。

鸿蒙OS LayoutScatter.Picker

LayoutScatter.Picker public static interface LayoutScatter.Picker 提供检查组件是否可以加载的方法。 方法总结 修饰符和类型 方法 描述 boolean isLoadClass(Class<?> clazz) 检查是否可以填充组件。 方法详情 isLoadClass boolean isLoadClass(Class<?> clazz) 检查是否可以填充组件。 参数: 参数名称 参数描述 clazz 表示将要填充的组件的类对象。 返回: 如果组件可以被填充,则返回 true; 否则返回 false。

鸿蒙OS IndexBar.OnSelectedListener

IndexBar.OnSelectedListener public static interface IndexBar.OnSelectedListener 回调以侦听和索引索引栏的更改事件。 方法总结 修饰符和类型 方法 描述 void onSelected(int index) 获取索引栏上的当前索引号。 方法详情 onSelected void onSelected(int index) 获取索引栏上的当前索引号。 参数: 参数名称 参数描述 index 指示索引栏上的当前索引号。

鸿蒙OS DatePicker.ValueChangedListener

DatePicker.ValueChangedListener public static interface DatePicker.ValueChangedListener 提供日期更改的侦听器。 您必须重写此类中的 onValueChanged(ohos.agp.components.DatePicker, int, int, int) 方法来侦听和处理 DatePicker 项的日期更改事件。 方法总结 修饰符和类型 方法 描述 void onValueChanged(DatePicker component, int year, int monthOfYear, int dayOfMonth) 处理日期选择器的日期更改事件。 方法详情 onValueChanged void onValueChanged(DatePicker component, int year, int monthOfYear, int dayOfMonth) 处理日期选择器的日期更改事件。 在 DatePicker 触发的日期更改事件时调用此方法。 它传递最新日期以处理日期更改事件。 参数: 参数名称 参数描述 component 指示与侦听器关联的组件(一个 DatePicker 实例)。 year 表示用户设置的年份(0 或更大)。 monthOfYear 表示用户设置的月份(1 到 12)。 dayOfMonth 表示用户设置的日期(1 到当月的总天数)。

鸿蒙OS DatePicker.DateOrder

DatePicker.DateOrder public static interface DatePicker.DateOrder 定义 DatePicker 组件的显示格式。 例如,日期可以以年-月-日或月-日-年的格式显示。 字段摘要 修饰符和类型 字段 描述 static int DAY 表示仅显示日期。 static int DM 表示日期以日月格式显示。 static int DMY 表示日期以日-月-年格式显示。 static int MD 表示日期以月日格式显示。 static int MDY 表示日期以月-日-年格式显示。 static int MONTH 表示只显示月份。 static int MY 表示日期以月-年格式显示。 static int YDM 表示日期以年-日-月格式显示。 static int YEAR 表示只显示年份。 static int YM 表示日期以年月格式显示。 static int YMD 表示日期以年-月-日格式显示。 字段详细信息 DAY static final int DAY 表示仅显示日期。 DM static final int DM 表示日期以日月格式显示。 DMY static final int DMY 表示日期以日-月-年格式显示。 MD static final int MD 表示日期以月日格式显示。 MDY static final int MDY 表示日期以月-日-年格式显示。 MONTH static final int MONTH 表示只显示月份。 MY static final int MY 表示日期以月-年格式显示。 YDM static final int YDM 表示日期以年-日-月格式显示。 YEAR static final int YEAR 表示只显示年份。 YM static final int YM 表示日期以年月格式显示。 YMD static final int YMD 表示日期以年-月-日格式显示。