- 語法:
<action android:name="string" />
- 包含於:
<intent-filter>
- 說明:
- 新增動作至意圖篩選器。
<intent-filter>
元素必須包含一或多個 <action>
元素。如果意圖篩選器中沒有任何 <action>
元素,篩選器就不會接受任何 Intent
物件。如需有關意圖篩選器和篩選器中動作規格角色的詳細資料,請參閱「意圖和意圖篩選器」。
- 屬性:
android:name
- 動作的名稱。部分標準動作在
Intent
類別中定義為 ACTION_string
常數。如要將其中一個動作指派給這個屬性,請在 ACTION_
後方的 string
前面加上「android.intent.action.
」。例如,如果是 ACTION_MAIN
,請使用「android.intent.action.MAIN
」,如果是 ACTION_WEB_SEARCH
,請使用「android.intent.action.WEB_SEARCH
」。
針對定義的動作,建議您使用應用程式的套件名稱做為前置字元,以確保唯一性。例如,TRANSMOGRIFY
動作可以指定如下:
<action android:name="com.example.project.TRANSMOGRIFY" />
- 導入版本:
- API 級別 1
- 另請參閱:
<intent-filter>
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2022-05-02 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"Translation issue"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]