Android manifest. xml Option

Source: Internet
Author: User

Some attribute definitions and usage in manifest. xml:

Certificate ----------------------------------------------------------------------------------------------------------------------------------

Android: allowtaskreparenting

 

Usage <application Android: allowtaskreparenting = "True/false"> </Application>

Whether to allow the activity to change the subordinate task, such as switching from a short message task to a browser task.

Indicates whether the activity can be moved from the started task to a task with affinity (when the task enters the foreground) -- "true", indicating that the activity can be moved, "false ", indicates that it must stay in the task at startup.

If this feature is not set, the value of the allowtaskreparenting attribute set to the <Application> element is applied to the activity. The default value is "false ".

Generally, when an activity is started, it is associated with the task that starts it and consumes its entire lifecycle. When the current task is no longer displayed, you can use this feature to force the activity to move to a task with affinity. A typical usage is to put an applicationProgramTo the main task of another application.

For example, if e-mail contains a webpage link, clicking it will start an activity to display this page. This activity is defined by the browser application, but now it is part of the E-mail task. If it re-hosts to the browser task, when the browser enters the foreground next time, it can be seen, and when the e-mail task enters the foreground again, you can't see it.

The affinity of actvity is defined by the taskaffinity feature. The affinity of a task is determined by reading the affinity of the root activity. Therefore, according to the definition, the root activity is always located in the task with the same affinity. Because the activity in the startup mode of "singletask" and "singleinstance" can only be located at the bottom of the task, re-hosting can only be limited to "standard" and "singletop" modes.

Certificate ----------------------------------------------------------------------------------------------------------------------------------

Android: alwaysretaintaskstate

 

Usage <activity Android: alwaysretaintaskstate = "True/false"> </activity>

Used to mark whether the status of the task where the activity is located is always maintained by the system -- "true", indicating always; "false ", it indicates that the system is allowed to restore the task to its initialization State under certain circumstances. The default value is "false ". This feature is only valid for the root activity of the task. For other activities, ignore it.

In general, in a specific situation, for example, when you reselect the task from the main screen, the system will clean up the task (delete all activivity located above the root activity from the stack ). In typical cases, this is also done when the user does not access this task for a period of time, for example, 30 minutes.

However, when this feature is set to "true", the user can always return to the latest status of the task, no matter how they start it. This is very useful. For example, for browser applications, there are many statuses (such as multiple open tabs), and users do not want to lose these statuses.

Certificate ----------------------------------------------------------------------------------------------------------------------------------

Android: cleartaskonlanunch

 

Usage <activity Android: cleartaskonlanunch = "True/false"> </activity>

Used to mark whether to clear all the activities from the task, except for the root activity (whenever the main screen is restarted) -- "true", indicating that it is always cleared to its root activity, "false" indicates no. The default value is "false ". This feature is only meaningful to the activity (root activity) that starts a new task; it is ignored for other activities in the task.

When the value is "true", every time the user restarts the task, it will enter its root activity, no matter what the task is doing, whether the user uses back or home to exit. When the value is "false", the activity of the task may be cleared in some cases (refer to the alwaysretaintaskstate feature), but not always.

Assume that someone starts activity P from the main screen and migrates it to activity Q from there. Next, press home and return activity p. Generally, you may see activity Q, because it is the final work content of the P task. However, if p sets this feature to "true", when the user presses home and causes this task to enter the foreground again, all the activities on it (Q here) will be cleared. Therefore, when this task is returned, the user can only see P.

If both this feature and allowtaskreparenting are set to "true", the re-host activity will be moved to the task that shares affinity; the remaining activity will be discarded, as described above.

Certificate -----------------------------------------------------------------------------------------------------------------------------------

Android: configchanges

 

When the configuration list is modified, whether to call the onconfigurationchanged () method, for example, "locale | navigation | orientation ".

For example, when you press the power key, you can simply process onpause in the application. When the app is a portrait screen, this is okay. However, when the app is a horizontal screen, press the power key to force the app to return to the portrait screen and call oncreate of activity again. In many cases, this is not the expected result, so Android: configchanges will be used.

Set Android: configchanges = "keyboardhidden | orientation" in the configuration file, so that the oncreate () method of the activity will not be called again when the screen direction changes, but onconfigurationchanged (), then focus on the activity.

@ Override

Public void onconfigurationchanged (configuration newconfig ){

Super. onconfigurationchanged (newconfig );

If (newconfig. Orientation = configuration. orientation_landscape ){

// Horizontal

} Else {

// Vertical

}

}

Certificate -----------------------------------------------------------------------------------------------------------------------------------

Android: Enabled

 

Can an activity be instantiated?

Usage: <activity Android: enabled = "true"> </activity>

Certificate -----------------------------------------------------------------------------------------------------------------------------------

Android: excludefromrecents

 

Whether it can be displayed in the list of recently opened activities

Usage: <activity Android: excludefromrecents = "true"> </activity>

Certificate ----------------------------------------------------------------------------------------------------------------------------------

Android: exported

 

Whether activity can be called by other programs

Certificate ----------------------------------------------------------------------------------------------------------------------------------

Android: finishontasklaunch

 

It is used to mark whether the existing activity instance needs to be closed (ended) -- "true" when the user starts the task again (this task is selected on the main screen), indicating that the task should be closed, "false" indicates not to close. The default value is "false ".

If both this feature and allowtaskreparenting are set to "true", this feature wins. The affinity of the activity is ignored. This activity will not be re-hosted, but will be destroyed.

Certificate ----------------------------------------------------------------------------------------------------------------------------------

Android. icon

Usage: <application Android: icon = "@ drawable/xx_icon"> </Application>

Certificate ----------------------------------------------------------------------------------------------------------------------------------

Android: Label

 

The name of each title column is defined, but the priority is lower than settitle () in activity ()

Else ---------------------------------------------------------------------------------------------------------------------------------

Android: launchmode

 

Used to indicate how the activity is started. There are four modes, which work with the activity flags (flag_activity _ * variable) in the intent object to determine how the activity starts to process the intent. They are:

"Standard"

"Singletop"

"Singletask"

"Singleinstance"

The default mode is "standard ".

"Standard" and "singletop" are the first group, and "singletask" and "singleinstance" are the second group.

The first group can be instantiated many times. These instances can belong to any task and can be located anywhere in the activity stack. Typically, they enter the task that calls startactivity () (unless the intent object contains the flag_activity_new_task flag, a different task will be selected in this case-refer to the taskaffinity feature ).

Slave --------------------------------------------------------------------------------------------------------------------------------

 

Android: Multiprocess

Allow multiple processes

Slave --------------------------------------------------------------------------------------------------------------------------------

Android: Name

 

Activity Class Name, which must be specified

 

Bytes -------------------------------------------------------------------------------------------------------------------------------

Android: onhistory

Whether to remove this activity when the user switches to another screen. This attribute is introduced in API Level 3.

Bytes -------------------------------------------------------------------------------------------------------------------------------

 

Android: Permission

Bytes -------------------------------------------------------------------------------------------------------------------------------

Android: Process

The process name of an activity. All program components run in the default process of the application. The process name is consistent with the package name of the application. The element process attribute in <Application> can set a new default value for all components. However, any component can overwrite this default value, allowing you to run your program in multiple processes. If the assigned name starts with ":", a new process dedicated to this program will be created when the activity is running. If the process name starts with a lowercase letter, the activity runs in a global process and is provided by its license.

Slave --------------------------------------------------------------------------------------------------------------------------------

 

Android: screenorientation

 

Activity display mode. "unspecified" Default Value: "Landscape" Landscape Painting mode. The width is greater than the height. The Portrait mode is greater than the width. "User" user's settings "behind" "sensor" "nosensor"

 

Else ---------------------------------------------------------------------------------------------------------------------------------

 

Android: statenotneeded

 

Whether the activity is destroyed or restarted successfully is not saved

 

Certificate ----------------------------------------------------------------------------------------------------------------------------------

 

Android: taskaffinity

 

The kinship of the activity. By default, the activity in the same application has the same relationship.

 

Slave --------------------------------------------------------------------------------------------------------------------------------

 

Android: Theme

 

If no theme is set, the theme style of the activity belongs to the application. For more information, see the theme attribute of the <Application> element.

Else ---------------------------------------------------------------------------------------------------------------------------------

 

Android: windowsoftinputmode

 

interaction mode between the activity main window and the keyboard, introduced since API Level 3

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.