AndroidManifest. xml file (activity) (2)

Source: Internet
Author: User
Tags home screen

Android: configChanges

This attribute lists configuration changes that require Activity self-processing. When the configuration changes occur during running, the Activity is disabled and restarted by default. However, declaring a configuration with this attribute will prevent the Activity from being restarted. On the contrary, this Activity will remain running and Its onConfigurationChanged () method will be called.

Note: Avoid using this attribute and use it as the final means. For how to properly handle restart during configuration change, see "handle run is changed" (http://www.bkjia.com/kf/201204/127330.html)

The following table lists the valid values of this attribute. When you want to set multiple values, connect them with the "|" symbol, for example, "locale | navigation | orientation"

Value Description
Mcc Self-processing is required when IMSI mobile country code changes-the system discovers a new SIM card and updates MCC.
Mnc Self-processing is required when the IMSI mobile network code changes-the system discovers a new SIM card and updates the MNC
Locale Self-processing is required when the language environment changes-the user selects a new language for displaying text.
Touchscreen Self-processing is required when the touch screen changes. (This usually does not happen)
Keyboard When the keyboard type changes, perform self-processing. For example, a user inserts an external keyboard
KeyboardHidden When the keyboard availability changes, you must perform self-processing. For example, you have enabled a hardware keyboard.
Navigation When the navigation type (trackball/direction board) changes, you must perform self-processing. This usually does not happen.
ScreenLayout Self-processing is required when the screen layout changes. This may be a change caused by different activation display methods.
FontScale Self-processing is required when the font scaling factor changes. If you select a new global font size.
UiMode When the user interface changes, you must perform self-processing. This situation occurs when the device is put into the desktop/car or the night mode changes. It is introduced in API Level 8.
Orientation When the orientation of the screen changes, you must perform self-processing. This change occurs when the user rotates the device.
Note: If the application's target API level is 13 or later, you should also declare the screenSize configuration, because when the device switches between the horizontal and vertical directions, the corresponding size also changes.
ScreenSize When the current valid screen size changes, you must perform self-processing. This change means that the current available relative length and width ratio of the size has changed, so when you switch between the horizontal and vertical, there will be a change in the available size of the screen. However, if the application is compiled on the API Level 12 or earlier, the Activity must always handle this change by itself (this configuration change will not restart the Activity, even if it is running on a device of Android or a later version ).
This setting is introduced in API Level 13.
SmallestScreenSize Self-processing is required when the physical size changes. This change does not focus on changes in the screen direction. It only happens when the actual physical screen size changes, such as switching to another display. This change corresponds to the configuration of the smallestWidth attribute. If the application is compiled on API Level 12 or earlier, the Activity must always handle this change by itself (this configuration change will not restart the Activity, even if it is running on a device of Android or a later version ).
This setting is introduced in API Level 13.
All these configuration changes will affect the resource values that can be seen in the application. Therefore, when the onConfigurationChanged () method is called, you usually need to obtain all the resources again (including layout resources, printable resources, and so on) to correctly handle these changes.
 

Android: enabled

This attribute is used to set whether the Activity can be instantiated by the system. If it is set to true, it can be instantiated. If it is set to false, it cannot be instantiated. The default value is true.

<Application> An element has its own enabled attribute, which is used by all components in the application, including Activity. This attribute of the <application> and <activity> elements must be set to true (both are true by default) so that the system can instantiate the Activity. Otherwise, the Activity cannot be instantiated.

Android: excledeFromRecents

This attribute is used to set whether tasks started by the Activity should be excluded from the list of recently used applications. That is to say, when the Activity is the root node of a new task, this attribute determines that the task adaptation needs to be displayed in the list of recently used applications. If it is set to true, this task will be excluded from the list. How to set it to false should be included in the recently used Application List. The default value is false.

Android: exported

This attribute is used to set whether the Activity can be started by another application component. If it is set to true, the Activity can be started; otherwise, the Activity cannot be started. If this parameter is set to false, the Activity can only be started by components in the same application or applications with the same user ID.

Its default value depends on whether the Activity contains the Intent filter. If no filter exists, it means that the Activity can only be called by a specific class name, this implies that the Activity can only be used within the application (because other users do not know its class name). In this case, the default value is false. On the other hand, if at least one filter exists, it implies that the Activity can be used externally, so the default value is true.

This attribute is not the only method to restrict Activity exposure to other applications. You can also use permissions to restrict external entities from calling the Activity.

Android: finishOnTaskLaunch

This attribute is used to set whether the task to which the existing Activity instance belongs should be disabled when the user starts again (select this task on the home screen. If this parameter is set to true, disable it. Otherwise, disable it. The default value is false.

If both this attribute and allowTaskReparenting are set to true, this attribute is superior to other attributes, and the kinship of the Activity is ignored. The Activity is destroyed instead of being transferred to the parent task.

Android: hardwareAccelerated

This attribute is used to set whether the Activity should enable hardware accelerated rendering. If this parameter is set to true, hardware acceleration is enabled. Otherwise, hardware acceleration is disabled. The default value is false.

Since Android3.0, hardware-accelerated OpenGL Renderer is available to applications to improve the performance of many common 2D graphic operations. When the hardware acceleration Renderer is enabled, most operations in Canva, Paint, Xfermode, ColorFilter, Shader, and Camera will be accelerated. This will make the animation and scrolling smoother and improve the overall response, even if the application does not explicitly need to use the framework's OpenGL class library. Because enabling hardware acceleration increases system resource requirements, applications occupy more memory.

Note that not all OpenGL 2D operations are accelerated. If hardware acceleration rendering is enabled, fully test the application to ensure that the rendering is correct.

Android: icon

This attribute defines an icon representing the Activity. When the Activity is required to be displayed on the screen, the icon is displayed to the user. For example, this icon is displayed in the Launcher window to start the task. This icon is often used in combination with the label attribute.

This attribute must be set to a resource that contains image definitions. If no settings are set, the icon set for the application is used instead.

The Activity icon (or the icon set by the <application> element) is the default icon of all Intent filters of the Activity.

Android: label

This attribute sets a readable label for the Activity. When the Activity is to be displayed to the user, the tag is displayed on the screen and will often be displayed together with the Activity icon.

If this attribute is not set, the TAG set for the application is used instead.

The Activity tag (or the TAG set by the <application> element) is the default tag of all Intent filters of the Activity.

This attribute should be set with a string resource. So that it can be localized in other languages on the user interface. However, you can also use the original string to set it to facilitate application development.

 


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.