- синтаксис:
<activity-alias android:enabled=["true" | "false"] android:exported=["true" | "false"] android:icon="drawable resource" android:label="string resource" android:name="string" android:permission="string" android:targetActivity="string" > ... </activity-alias>
- содержится в:
-
<application>
- может содержать:
-
<intent-filter>
<meta-data>
- описание:
- Псевдоним действия, названный атрибутом
targetActivity
. Цель должна находиться в том же приложении, что и псевдоним, и быть объявлена перед псевдонимом в манифесте.Псевдоним представляет целевое действие как независимую сущность и может иметь собственный набор фильтров намерений. Они, а не фильтры намерений самой целевой активности, определяют, какие намерения могут активировать цель через псевдоним и как система обрабатывает псевдоним.
Например, фильтры намерений псевдонима могут указывать флаги
"android.intent.action.MAIN"
и"android.intent.category.LAUNCHER"
, в результате чего он будет представлен в средстве запуска приложений, даже если ни один из фильтров в самом целевом действии установите эти флаги.За исключением
targetActivity
, атрибуты<activity-alias>
являются подмножеством атрибутов<activity>
. Для атрибутов в подмножестве ни одно из значений, установленных для цели, не переносится на псевдоним. Однако для атрибутов, не входящих в подмножество, значения, установленные для целевого действия, также применяются к псевдониму. - атрибуты:
-
android:enabled
- Может ли система создать экземпляр целевого действия через этот псевдоним.
"true"
если это возможно, и"false"
если нет. Значение по умолчанию —"true"
.Элемент
<application>
имеет собственный атрибутenabled
, который применяется ко всем компонентам приложения, включая псевдонимы действий. Атрибуты<application>
и<activity-alias>
должны иметь значение"true"
чтобы система могла создать экземпляр целевого действия через псевдоним. Если любой из них имеет значение"false"
, псевдоним не работает. -
android:exported
- Могут ли компоненты других приложений запускать целевую активность через этот псевдоним.
"true"
если могут, и"false"
если нет. Если"false"
, целевая активность может быть запущена через псевдоним только компонентами того же приложения, что и псевдоним, или приложениями с тем же идентификатором пользователя.Значение по умолчанию зависит от того, содержит ли псевдоним фильтры намерений. Отсутствие каких-либо фильтров означает, что активность можно вызвать через псевдоним, только указав точное имя псевдонима. Это означает, что псевдоним предназначен только для использования внутри приложения, поскольку другие не знают его имени. Итак, значение по умолчанию —
"false"
. С другой стороны, наличие хотя бы одного фильтра подразумевает, что псевдоним предназначен для внешнего использования, поэтому значение по умолчанию —"true"
. -
android:icon
- Значок целевого действия, представленный пользователям через псевдоним. Дополнительную информацию см. в атрибуте
icon
элемента<activity>
. -
android:label
- Читаемая пользователем метка псевдонима, представленная пользователям через псевдоним. Дополнительную информацию см. в атрибуте
label
элемента<activity>
. -
android:name
- Уникальное имя псевдонима. Имя напоминает полное имя класса. Но, в отличие от названия целевой активности, псевдоним является произвольным. Это не относится к реальному классу.
-
android:permission
- Имя разрешения, которое клиенты должны иметь для запуска целевого действия или получения от него каких-либо действий с использованием псевдонима. Если вызывающему объекту
startActivity()
илиstartActivityForResult()
не предоставлено указанное разрешение, целевое действие не активируется.Этот атрибут заменяет любой набор разрешений для самого целевого действия. Если оно не установлено, разрешение не требуется для активации цели через псевдоним.
Дополнительные сведения о разрешениях см. в разделе «Разрешения» в обзоре манифеста приложения.
-
android:targetActivity
- Имя активности, которую можно активировать через псевдоним. Это имя должно соответствовать атрибуту
name
элемента<activity>
, который предшествует псевдониму в манифесте.
-
- представлено в:
- API уровня 1
- см. также:
-
<activity>
<псевдоним активности>
Контент и образцы кода на этой странице предоставлены по лицензиям. Java и OpenJDK – это зарегистрированные товарные знаки корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2025-07-29 UTC.
[[["Прост для понимания","easyToUnderstand","thumb-up"],["Помог мне решить мою проблему","solvedMyProblem","thumb-up"],["Другое","otherUp","thumb-up"]],[["Отсутствует нужная мне информация","missingTheInformationINeed","thumb-down"],["Слишком сложен/слишком много шагов","tooComplicatedTooManySteps","thumb-down"],["Устарел","outOfDate","thumb-down"],["Проблема с переводом текста","translationIssue","thumb-down"],["Проблемы образцов/кода","samplesCodeIssue","thumb-down"],["Другое","otherDown","thumb-down"]],["Последнее обновление: 2025-07-29 UTC."],[],[],null,["# <activity-alias\u003e\n\nsyntax:\n:\n\n ```xml\n \u003cactivity-alias android:enabled=[\"true\" | \"false\"]\n android:exported=[\"true\" | \"false\"]\n android:icon=\"drawable resource\"\n android:label=\"string resource\"\n android:name=\"string\"\n android:permission=\"string\"\n android:targetActivity=\"string\" \u003e\n ...\n \u003c/activity-alias\u003e\n ```\n\ncontained in:\n: [\u003capplication\u003e](/guide/topics/manifest/application-element)\n\ncan contain:\n: [\u003cintent-filter\u003e](/guide/topics/manifest/intent-filter-element)\n\n [\u003cmeta-data\u003e](/guide/topics/manifest/meta-data-element)\n\ndescription:\n: An alias for an activity, named by the `targetActivity`\n attribute. The target must be in the same application as the\n alias and declared before the alias in the manifest.\n\n\n The alias presents the target activity as an independent entity, and can have its own set of intent\n filters. They, rather than the\n intent filters on the target activity itself, determine which intents\n can activate the target through the alias and how the system\n treats the alias.\n\n For example, the intent filters on the alias might\n specify the [\"android.intent.action.MAIN\"](/reference/android/content/Intent#ACTION_MAIN)\n and [\"android.intent.category.LAUNCHER\"](/reference/android/content/Intent#CATEGORY_LAUNCHER)\" flags, causing it to\n be represented in the application launcher, even though none of the\n filters on the target activity itself set these flags.\n\n\n With the exception of `targetActivity`, `\u003cactivity-alias\u003e`\n attributes are a subset of [\u003cactivity\u003e](/guide/topics/manifest/activity-element) attributes.\n For attributes in the subset, none of the values set for the target carry over\n to the alias. However, for attributes not in the subset, the values set for\n the target activity also apply to the alias.\n\nattributes:\n:\n\n `android:enabled`\n : Whether the target activity can be instantiated by the system through\n this alias. `\"true\"` if it can be, and `\"false\"` if not.\n The default value is `\"true\"`.\n\n\n The [\u003capplication\u003e](/guide/topics/manifest/application-element) element has its own\n [enabled](/guide/topics/manifest/application-element#enabled) attribute that applies to all\n application components, including activity aliases. The\n `\u003capplication\u003e` and `\u003cactivity-alias\u003e`\n attributes must both be `\"true\"` for the system to be able to instantiate\n the target activity through the alias. If either is `\"false\"`, the alias\n doesn't work.\n\n `android:exported`\n : Whether the components of other applications can launch the target activity\n through this alias. `\"true\"` if they can, and `\"false\"` if not.\n If `\"false\"`, the target activity can be launched through the alias only by\n components of the same application as the alias or applications with the same user ID.\n\n\n The default value depends on whether the alias contains intent filters. The\n absence of any filters means that the activity can be invoked through the alias\n only by specifying the exact name of the alias. This implies that the alias\n is intended only for application-internal use, since others don't know its name.\n So, the default value is `\"false\"`.\n On the other hand, the presence of at least one filter implies that the alias\n is intended for external use, so the default value is `\"true\"`.\n\n `android:icon`\n : An icon for the target activity when presented to users through the alias.\n For more information, see the [\u003cactivity\u003e](/guide/topics/manifest/activity-element) element's\n [icon](/guide/topics/manifest/activity-element#icon) attribute.\n\n `android:label`\n : A user-readable label for the alias when presented to users through the alias.\n For more information, see the [\u003cactivity\u003e](/guide/topics/manifest/activity-element) element's\n [label](/guide/topics/manifest/activity-element#label) attribute.\n\n \u003cbr /\u003e\n\n `android:name`\n\n : A unique name for the alias. The name resembles a fully qualified class name. But, unlike the name of the target activity, the alias name is arbitrary. It doesn't refer to an actual class. \u003cbr /\u003e\n\n `android:permission`\n : The name of a permission that clients must have to launch the target activity\n or get it to do something using the alias. If a caller of\n [startActivity()](/reference/android/content/Context#startActivity(android.content.Intent)) or\n [startActivityForResult()](/reference/android/app/Activity#startActivityForResult(android.content.Intent, int))\n isn't granted the specified permission, the target activity isn't activated.\n\n This attribute supplants any permission set for the target activity itself. If\n it isn't set, a permission isn't needed to activate the target through the alias.\n\n\n For more information about permissions, see the\n [Permissions](/guide/topics/manifest/manifest-intro#perms)\n section in the app manifest overview.\n\n `android:targetActivity`\n : The name of the activity that can be activated through the alias.\n This name must match the `name` attribute of an\n [\u003cactivity\u003e](/guide/topics/manifest/activity-element) element that precedes\n the alias in the manifest.\n\n \u003cbr /\u003e\n\nintroduced in:\n: API level 1\n\nsee also:\n: [\u003cactivity\u003e](/guide/topics/manifest/activity-element)"]]