Android Manifest之元素中文注释

<action>

语法

<action android:name="string" />

父元素

<intent-filter>

描述

    对intent filter添加action。<intent-filter>元素必须包含一个或多个<action>元素。如果它不包含任何<action>,那么将没有intents object能通过这个过滤器。关于intent filters和过滤器中action说明书参见Intents and Intent filters

属性

android:name

这是action的名称。在Intent类中定义了一些标准的actions作为ACTION_string常量。为了给这个属性分配这些actions,就要向后面的ACTION_串前置“android.intent.action.”。例如,对ACTION_MAIN来说,就要使用“android.intent.action.ACTION_MAIN”,同时对ACTION_WEB_SEARCH来说,就要使用“android.intent.action.ACTION_WEB_SEARCH”。

 

对于自定义的actions来说,用包名来作为前缀是最好的,因为它能保证唯一性。例如,TRANSMOGRIFY的action可以通过如下方式指定:

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

出处

API Level 1

你可能感兴趣的:(action,ACTION_MAIN)