Android Manifest usage

Some attribute definitions and usage in Manifest.xml:

----------------------------------------------------------------------------------------------------------------------------------

android: allowTaskReparenting        

 

         用法<application android:allowTaskReparenting="true/false"></application>

Whether to allow replacement of activity dependent tasks, such as task switching from the short message to the browser task.

Activity can be used to mark the start of the Task move has affinity to the Task (when the Task into the foreground) - "true", represents able to move, "false", expressed stay when it must stay that starts Task years.

        If this feature has not been set, set the <application> allowTaskReparenting characteristic value on the element will be applied to the Activity. The default value is "false".

       In general, when the Activity starts, it starts Task associated with it, and where exhausted its entire life cycle. When the current Task is no longer displayed, you can use this feature to force Activity move has affinity to the Task. Typical usage is: Activity of an application to move the main Task another application.

       For example, if the e-mail contains a link to a web page, click on it will start an Activity to display this page. Activity is defined by the Browser application, but now as part of the e-mail Task. If it is host to the Browser Task again, the time when the next Browser into the foreground, it can be seen, and, when the e-mail Task brought to the foreground again, you can not see it.

       The affinity Actvity characteristic defined by taskAffinity. Task of affinity is affinity decided by reading the root Activity. Therefore, by definition, they are always located in the root Activity Task same affinity of years. Since the start mode "singleTask" and "singleInstance" Activity only at the bottom of the Task, therefore, only limited re-host "standard" and "singleTop" mode.

----------------------------------------------------------------------------------------------------------------------------------

android:alwaysRetainTaskState

 

       用法<activity android:alwaysRetainTaskState="true/false"></activity>

        Task is used to mark whether the state is always located Activity is maintained by the system - "true", indicates always; "false", the system is allowed to resume its Task initialization state under certain circumstances. The default value is "false". This feature is only meaningful for the root Activity Task; Other Activity for it, ignore it.

        In general, a particular situation, such as when the user selects the Task From the home screen again, the system will Task clean (remove from the stack located above the root of all Activivity Activity). Typically, there is a period of time when the user does not have access to this Task would do, for example, 30 minutes.

       However, when this feature is set to "true", the user can always return to the Task date, regardless of how they started. This is useful, for example, like Browser application, there are a lot of states (for example, multiple open Tab), users do not want to lose these states.

----------------------------------------------------------------------------------------------------------------------------------

android:clearTaskOnLanunch

 

         用法<activity android:clearTaskOnLanunch=”true/false”></activity>

         Flag is used to clear all Activity from Task, in addition to the root Activity (restarted each time from the main screen) - "true", indicates that it is always clear to the root Activity, "false" indicates not. The default value is "false". This feature only the start of a new Task Activity (root Activity) makes sense; on the other Task Activity ignored.

         When this value is "true", each time the user to restart the Task, will enter into its root Activity in, no matter what the final Task doing, regardless of the user is to use the BACK HOME or leave. When this value is "false", may be cleared Activity Task in some circumstances (refer alwaysRetainTaskState characteristics), but not always.

         Suppose, someone started the Activity P from the main screen, and migrate from there to the Activity Q. Next, the user presses the HOME, and then returns Activity P. Generally, users may see that Activity Q, because it is the Task P content in the final work. However, if the characteristic P is set to "true", and when the user presses the HOME Task again brought to the foreground, on which all the Activity (in this case, Q) will be cleared. Therefore, when you return to the Task, users see only P.

         If this feature and allowTaskReparenting are set to "true", those Activity can re-host will move to the Task shared affinity in; the rest of the Activity will be abandoned, as described above.

-----------------------------------------------------------------------------------------------------------------------------------

android:configChanges

 

         When configuring the list is modified, whether to call onConfigurationChanged () methods such as "locale | navigation | orientation".

         Example: When the power button is pressed, directly in the application process onPause like. When the app is the vertical screen when this treatment is no problem. But when the app is a horizontal screen, press the power button, app will be forced back to portrait, and will recall activity of onCreate. In many cases this is not the intended result, it will be used android: configChanges.

         Android settings in the configuration file: configChanges = "keyboardHidden | orientation", so that the screen orientation does not change when he recalled the activity onCreate () method, but calls onConfigurationChanged (), and then try the next in the activity inside.

@Override

public void onConfigurationChanged(Configuration newConfig){

         super.onConfigurationChanged(newConfig);

         if(newConfig.orientation==Configuration.ORIENTATION_LANDSCAPE){

                   // Landscape

         }else{

                   // Vertical

         }

}

-----------------------------------------------------------------------------------------------------------------------------------

android:enabled

 

         If the activity can be instantiated

         用法:<activity android:enabled="true"></activity>

-----------------------------------------------------------------------------------------------------------------------------------

android:excludeFromRecents

 

         It can be displayed in the list of recently opened in activity

         用法:<activity android:excludeFromRecents="true"></activity>

----------------------------------------------------------------------------------------------------------------------------------

android:exported

 

         Whether to allow the activity to be called by other programs

----------------------------------------------------------------------------------------------------------------------------------

android:finishOnTaskLaunch

 

         Activity used to mark instance when the user starts its Task again (select this Task in the main screen) already exists whether or not to close (end) - "true", indicates you should turn off, "false" represents not closed. The default value is "false".

         If this feature and allowTaskReparenting are set to "true", this feature win. Activity of affinity ignored. This Activity will not re-host, but will be destroyed.

----------------------------------------------------------------------------------------------------------------------------------

android.icon

 

         Usage: <application android: icon = "@ drawable / xx_icon"> </ application>, add the application icon

----------------------------------------------------------------------------------------------------------------------------------

android:label

 

         It defines the name of each title bar, but a lower priority than activity in setTitle ()

---------------------------------------------------------------------------------------------------------------------------------

android:launchMode

 

         Activity instructions for how to start. There are four models, with the Intent object Activity Flags interaction (FLAG_ACTIVITY_ * variable), to determine how to handle the start Activity Intent. They are:

          "standard"

          "singleTop"

          "singleTask"

          "singleInstance"

          The default mode is "standard".

         "Standard" and "singleTop" for the first group, "singleTask" and "singleInstance" a second group.

         The first set may be instantiated many times. These examples can belong to any task and can be located anywhere in the activity stack. Typically, they will enter the call startActivity () of Task (unless the Intent object contains FLAG_ACTIVITY_NEW_TASK mark, in this case will choose a different Task-- reference taskAffinity characteristics).

--------------------------------------------------------------------------------------------------------------------------------

 

android:multiprocess

It allows multiple processes

--------------------------------------------------------------------------------------------------------------------------------

android:name

 

activity class name must be specified

 

-------------------------------------------------------------------------------------------------------------------------------

android:onHistory

Whether this activity need to be removed when the user switches to another screen. This property is introduced into the 3 API level of

-------------------------------------------------------------------------------------------------------------------------------

 

android:permission

-------------------------------------------------------------------------------------------------------------------------------

android:process

A process name where the activity is running, all program components running in the default application process, this process were consistent with the package name of the application. Process attribute element <application> can be set in a default for all new components. But any component can override this default, allowing you to put your program in a multi-process operation. If this attribute is assigned to the name: the beginning of the process, when this activity is running, a new exclusively for this program will be created. If the process name, run this activity will start with a lowercase letter in the overall process, it is provided by the license.

--------------------------------------------------------------------------------------------------------------------------------

 

android:screenOrientation

 

Display mode of activity, "unspecified" Default "landscape" landscape mode, the height of the larger width "portrait" portrait mode, larger than the width than height. "User" user settings "behind" "sensor" "nosensor"

 

---------------------------------------------------------------------------------------------------------------------------------

 

android:stateNotNeeded

 

Whether the activity is destroyed and the successful restart does not save state

 

----------------------------------------------------------------------------------------------------------------------------------

 

android:taskAffinity

 

Kinship activity, and by default have the same relationship with the activity under application

 

--------------------------------------------------------------------------------------------------------------------------------

 

android:theme

 

activity style theme, if not set, the activity of the subordinate theme theme style property application, see the <application> element

---------------------------------------------------------------------------------------------------------------------------------

 

android:windowSoftInputMode

 

activity of the main window and the soft keyboard-interactive mode, since the API level 3 is introduced

Reproduced in: https: //my.oschina.net/lendylongli/blog/226799

Guess you like

Origin blog.csdn.net/weixin_33862514/article/details/92576473