AndroidManifest.xml文件中<action>元素用法

AndroidManifest.xml文件中<action>元素用法

元素必须放在<intent-filter>中,形如:


<intent-filter ... >
<action android:name="string" />
</intent-filter>

用法描述:

添加actionintent filter中.<intent-filter>元素里面必须有一个以上的<action>元素。如果<intent-filter>元素里面没有<action>元素,该过滤器将不接收任何Intent对象。

属性(attributes):

android:name

一些标准的action已经作为常量(形如ACTION_string) 预定义在了Intent类里面。如果要赋值这类预定义的action到该属性中,
我们需要先输入”android.intent.action.” ,接着是ACTION_。例如ACTION_MAIN便可以用”android.intent.action.MAIN
ACTION_WEB_SEARCH便是用”android.intent.action.WEB_SEARCH“.

如果是自定义一种action,命名建议最好使用应用程序的包名称作为前缀,以此可以更好的保证其唯一性。如TRANSMOGRIFY行为可以定义为:


<action android:name="com.example.project.TRANSMOGRIFY" />

要求的API等级:1

原文地址 https://blog.csdn.net/u013560890/article/details/81263002

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值