AndroidManifest. xml file (activity) (1)

Source: Internet
Author: User
Tags home screen

Syntax (SYNATX ):

<Activityandroid: allowTaskReparenting = ["true" | "false"]
Android: alwaysRetainTaskState = ["true" | "false"]
Android: clearTaskOnLaunch = ["true" | "false"]
Android: configChanges = ["mcc", "mnc", "locale ",
"Touchscreen", "keyboard", "keyboardHidden ",
"Navigation", "screenLayout", "fontScale", "uiMode ",
"Orientation", "screenSize", "smallestScreenSize"]
Android: enabled = ["true" | "false"]
Android: excludeFromRecents = ["true" | "false"]
Android: exported = ["true" | "false"]
Android: finishOnTaskLaunch = ["true" | "false"]
Android: hardwareAccelerated = ["true" | "false"]
Android: icon = "drawable resource"
Android: label = "string resource"
Android: launchMode = ["multiple" | "singleTop" |
"SingleTask" | "singleInstance"]
Android: multiprocess = ["true" | "false"]
Android: name = "string"
Android: noHistory = ["true" | "false"]
Android: permission = "string"
Android: process = "string"
Android: screenOrientation = ["unspecified" | "user" | "behind" |
"Landscape" | "portrait" |
"ReverseLandscape" | "reversePortrait" |
"SensorLandscape" | "sensorPortrait" |
"Sensor" | "fullSensor" | "nosensor"]
Android: stateNotNeeded = ["true" | "false"]
Android: taskAffinity = "string"
Android: theme = "resource or theme"
Android: uiOptions = ["none" | "splitActionBarWhenNarrow"]
Android: windowSoftInputMode = ["stateUnspecified ",
"StateUnchanged", "stateHidden ",
"StateAlwaysHidden", "stateVisible ",
"StateAlwaysVisible", "adjustUnspecified ",
"AdjustResize", "adjustPan"]>
...
</Activity>

 

Contained in (contained in ):

<Application>

Can contain ):

<Intent-filter>

<Meta-data>

DESCRIPTION ):

This element declares an Activity (or a subclass of the Activity), which implements the Visualized User Interface of the application. All the activities in the application must be declared with the <Activity> element in the list file. The system does not see or run the activity that is not declared in the list file.

ATTRIBUTES (ATTRIBUTES ):

Android: allowTaskReparenting

This attribute is used to set the Activity to be transferred from the task that starts it to another task that is related to the task that starts it, the transfer time is when this kinship task is taken to the front-end. If true is set, it can be transferred. If false is set, the Activity must be retained in the task where it is started.

If this attribute is not set, the allowTaskReparenting attribute value of the corresponding <application> element will be applied to this Activity. The default value is false.

Generally, when an Activity is started, it will be associated with the task that starts it, and its entire lifecycle will be maintained in that task. However, when the current task of the Activity is not displayed, you can use this attribute to force the Activity to be transferred to a task that is closely related to the current task. A typical application in this case transfers the Activity of an application to the project owner associated with the application.

For example, if an email message contains a webpage link, clicking this link will start an Activity that displays the webpage. However, the Activity started by the e-mail task is defined by the browser application. If you put it in a browser task, the page will be displayed the next time the browser starts to the foreground, and the Activity will disappear when the e-mail task is displayed again.

The kinship of an Activity is defined by the taskAffinity attribute. Read the kinship of the Root Activity of the task to determine the kinship of the task. Therefore, by definition, the root Activity in the task has the same kinship with the task. Therefore, an Activity with singleTask or singleInstance startup mode can only be the root node of the task. The task attribution of the Activity is limited by standard and singleTop modes.

Android: alwaysRetainTaskState

This attribute is used to set whether the status of the task to which the Activity belongs is always maintained by the system. If it is set to true, the system maintains the status and sets it to false. In some cases, the system allows you to reset the initial status of the task. The default value is false. This attribute only makes sense to the Activity of the root node of the task, and all other activities will be ignored.

In general, in some cases, when you restart a task from the main screen, the system first clears the task (delete all the activities on the Root Node Activity from the stack ).

However, when this attribute is set to true, the user will always return to the final state of the task, regardless of the operations in the middle. This method is advantageous. For example, Web browser applications retain the state that many users do not want to lose, such as multiple opened tabs.

Android: clearTaskOnLaunch

This attribute is used to set whether to delete all other activities in the task except the Activity of the root node when the task is restarted from the home screen. If it is set to true, all the activities on the Activity of the task root node will be cleared. If it is set to false, the Activity will not be cleared. The default value is false. This attribute only makes sense for the Activity that starts the new task (or the root Activity), and all other activities in the task will be ignored.

When this attribute value is set to true, the Activity of the root node of the task is displayed when the user starts the task again, regardless of what is done at the end of the task, whether the task uses the Back button or the Home button. When this attribute is set to false, the Activity of this task can be cleared in some cases, but this is not always the case.

For example, assume that someone starts Activity P from the main screen and Activity Q from P. Next, the user presses the Home button and then returns to Activity P. Generally, the user will see Activity Q, because this is the last thing done in the P task. However, if P sets this attribute to true, all the activities above Activity P (in this example, Activity Q) will be suspended when the user presses the Home button) will be deleted. Therefore, when the user returns to this task again, the user can only see Activity P.

If both this attribute and the allowTaskReparenting attribute are set to true, the activities with kinship settings will be transferred to their shared kinship tasks, and the remaining activities will be deleted.

 


From FireOfStar's column

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.