AndroidManifest.xml文件中<action>元素用法
元素必须放在<intent-filter>中,形如:
<intent-filter ... >
<action android:name="string" />
</intent-filter>
用法描述:
添加action到intent 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.youkuaiyun.com/u013560890/article/details/81263002