树叶云鸿蒙OS教程:鸿蒙OS NotificationActionButton

NotificationActionButton

java.lang.Object

|—ohos.event.notification.NotificationActionButton

public class NotificationActionButton
extends Object
implements Sequenceable

封装要在通知中显示的操作按钮。 您可以调用 NotificationRequest#addActionButton 将操作按钮添加到通知。

NotificationActionButton 对象必须包含一个图标、一个标题和一个关联的 IntentAgent,定义了单击操作按钮时要触发的操作。

Since:

3

嵌套类摘要

修饰符和类型类描述
static classNotificationActionButton.BuilderNotificationActionButton 对象的生成器类。
从接口 ohos.utils.Sequenceable 继承的嵌套类/接口
Sequenceable.ProducerT

字段摘要

修饰符和类型字段描述
static Sequenceable.ProducerNotificationActionButtonPRODUCER从 Parcel 创建 NotificationActionButton 实例。

方法总结

修饰符和类型方法描述
PacMapgetAdditionalData()获取包含在此 NotificationActionButton 中的附加数据。
PixelMapgetIcon()获取此 NotificationActionButton 的图标。
IntentAgentgetIntentAgent()获取此 NotificationActionButton 的 IntentAgent。
ListNotificationUserInputgetMimeTypeOnlyUserInputs()在发送此 NotificationActionButton 时,获取仅允许特定 MIME 类型的值的 NotificationUserInput 对象。
intgetSemanticActionButton()获取此 NotificationActionButton 的语义操作。
StringgetTitle()获取此 NotificationActionButton 的标题。
ListNotificationUserInputgetUserInputs()获取发送此 NotificationActionButton 时向用户收集的 NotificationUserInput 对象。
booleanisAutoCreatedReplies()检查平台是否可以自动为此 NotificationActionButton 生成可能的回复。
booleanisContextDependent()检查此 NotificationActionButton 是否为上下文操作,即此 NotificationActionButton 是否依赖于通知消息体。
booleanmarshalling(Parcel out)将 NotificationActionButton 对象编组到 Parcel 中。
StringtoString()返回对象的字符串表示形式。
booleanunmarshalling(Parcel in)从 Parcel 中解组 NotificationActionButton 对象。
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
从接口 ohos.utils.Sequenceable 继承的方法
hasFileDescriptor

字段详细信息

PRODUCER

public static final Sequenceable.ProducerNotificationActionButton PRODUCER

从 Parcel 创建 NotificationActionButton 实例。

Since:

4

方法详情

getIcon

public PixelMap getIcon()

获取此 NotificationActionButton 的图标。

返回:

返回此 NotificationActionButton 的图标。

Since:

3

getAdditionalData

public PacMap getAdditionalData()

获取包含在此 NotificationActionButton 中的附加数据。

返回:

返回此 NotificationActionButton 中包含的附加数据。

Since:

3

getUserInputs

public ListNotificationUserInput getUserInputs()

获取发送此 NotificationActionButton 时向用户收集的 NotificationUserInput 对象。

返回:

返回 NotificationUserInput 对象的列表。

Since:

3

getMimeTypeOnlyUserInputs

public ListNotificationUserInput getMimeTypeOnlyUserInputs()

在发送此 NotificationActionButton 时,获取仅允许特定 MIME 类型的值的 NotificationUserInput 对象。

返回:

返回仅允许特定 MIME 类型值的 NotificationUserInput 对象列表。

Since:

3

isAutoCreatedReplies

public boolean isAutoCreatedReplies()

检查平台是否可以自动为此 NotificationActionButton 生成可能的回复。

返回:

如果平台可以生成回复,则返回 true; 否则返回 false。

Since:

3

isContextDependent

public boolean isContextDependent()

检查此 NotificationActionButton 是否为上下文操作,即此 NotificationActionButton 是否依赖于通知消息体。 例如,上下文 NotificationActionButton 在通知中为用户打开地图应用程序提供地址。

返回:

如果此 NotificationActionButton 是上下文操作,则返回 true; 否则返回 false。

Since:

3

getTitle

public String getTitle()

获取此 NotificationActionButton 的标题。

返回:

返回此 NotificationActionButton 的标题。

Since:

3

getIntentAgent

public IntentAgent getIntentAgent()

获取此 NotificationActionButton 的 IntentAgent。

返回:

返回此 NotificationActionButton 的 IntentAgent。

Since:

3

getSemanticActionButton

public int getSemanticActionButton()

获取此 NotificationActionButton 的语义操作。

返回:

返回此 NotificationActionButton 的语义操作,如 NotificationConstant.SemanticActionButton 中所枚举。

Since:

3

marshalling

public boolean marshalling(Parcel out)

将 NotificationActionButton 对象编组到 Parcel 中。

进程可以调用 unmarshalling(ohos.utils.Parcel) 方法从 Parcel 中解组 NotificationActionButton 对象,以实现进程间通信 (IPC)。

指定者:

接口 Sequenceable 中的编组

参数:

参数名称参数描述
out指示用于编组的 MessageParcel 对象。 MessageParcel 是 Parcel 的子类。

返回:

如果编组成功,则返回 true; 否则返回 false。

Since:

4

unmarshalling

public boolean unmarshalling(Parcel in)

从 Parcel 中解组 NotificationActionButton 对象。

指定者:

在接口 Sequenceable 中解组

参数:

参数名称参数描述
in指示用于编组的 MessageParcel 对象。 MessageParcel 是 Parcel 的子类。

返回:

如果解组成功,则返回 true; 否则返回 false。

Since:

4

toString

public String toString()

从类复制的描述:对象

返回对象的字符串表示形式。 通常,toString 方法返回一个“以文本方式表示”该对象的字符串。 结果应该是一个简洁但信息丰富的表示,易于人们阅读。 建议所有子类重写此方法。

Object 类的 toString 方法返回一个字符串,该字符串由对象作为其实例的类的名称、at 符号字符“@”和对象哈希码的无符号十六进制表示形式组成。 换句话说,此方法返回一个等于以下值的字符串:

 getClass().getName() + '@' + Integer.toHexString(hashCode()) 

覆盖:

类 Object 中的 toString

返回:

对象的字符串表示形式。

Since:

4

文章来源网络,作者:管理,如若转载,请注明出处:https://shuyeidc.com/wp/171567.html<

赞 (0)
管理的头像管理
上一篇2025-03-22 22:20
下一篇 2025-03-22 22:22

相关推荐

  • jsp空间购买和交换数据空间怎么买,有哪些注意事项?

    购买JSP空间时,是否考虑过数据交换空间的性能?简米科技(2003年始创,23年行业沉淀)与酷番云(工信部一类增值电信全牌照)这类持牌自营机房的服务商,能确保数据交换的高效稳定,是值得优先选择的合作伙伴,为什么JSP空间需要搭配独立的数据交换空间从JSP应用特性看数据交换需求JSP基于Java技术,常用于企业级……

    2026-08-11
    0
  • 建网站用香港空间效果怎么样,香港空间稳定吗?

    建网站用香港空间,对于创建网站资产来说,核心价值在于免备案和全球带宽优势,尤其适合外贸、跨境电商和需要快速启动的项目,但你必须权衡国内访问延迟,并选择有资质的服务商以保证资产安全,香港空间的核心优势与适用边界免备案:节省时间就是节省成本国内服务器需要备案,通常需要10到20天,香港空间无需备案,域名解析后即可上……

    2026-08-11
    0
  • Java连接云数据库的方法是什么,如何操作

    Java连接云数据库的核心在于通过JDBC驱动,结合云服务商提供的连接地址、端口、数据库名及认证信息,配置安全策略(如SSL、IP白名单),即可实现稳定高效的远程数据库访问,基础准备:JDBC驱动与依赖管理连接云数据库前,需要确保开发环境具备对应的JDBC驱动,以最常见的MySQL为例,你需要引入mysql-c……

    2026-08-11
    0
  • 建网站公安联网备案必须使用数据码吗,备案流程是什么

    网站备案包括ICP备案和公安联网备案,两者缺一不可,公安联网备案必须使用服务商提供的数据码,选择持有合法资质的服务商是顺利通过备案的前提,为什么网站必须进行公安联网备案根据公安部《计算机信息网络国际联网安全保护管理办法》,网站开通后30日内必须到公安机关办理备案手续,未完成公安备案的网站,面临责令整改、关闭网站……

    2026-08-10
    0
  • 建一个企业网站大概需要多少钱?,怎么收费?

    建网站要多少钱,没有一个固定的数字,几百到几万都可能,但真正的“创建网站资产”绝不仅仅是初次投入的成本,而是基于长期稳定、合规和安全的持续性投入,其中核心取决于你选择了什么样的“地基”来承载你的业务,建站预算的构成与行业基准当你开始规划一个网站,最先面对的就是预算问题,一个常见的误区是只关注网站“看起来”的建造……

    2026-08-10
    0

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注