您的位置:首页 > 移动开发 > Android开发

Android开发-API指南-<action>

2014-12-22 11:28 351 查看

<action>

英文原文:http://developer.android.com/guide/topics/manifest/action-element.html

采集(更新)日期:2014-6-27

搬迁自原博客:http://blog.sina.com.cn/s/blog_48d491300100zmfi.html

语法:
<action android:name="string" />

包含于
<intent-filter>
说明:在 Intent 过滤器中添加一个 Action。
<intent-filter>
元素必须包含一个或多个
<action>
元素。 如果其中没有包含任何
<action>
元素,则过滤器不会收到任何 Intent 对象。 关于 Intent 过滤器及过滤器内各种 Action 的用途,详情请参阅 Intent 和 Intent 过滤器属性:
android:name
Action 的名称。
Intent
类中已经以
ACTION_string
常量的形式定义了一些标准的 Action。 要将这些 Action 赋予本属性,请以“
android.intent.action.
”作为前缀,加在
ACTION_
后的
string
前面。 例如,对于
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参阅
<intent-filter>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: