Android official documentation: (2) Application List -- 2.22 & lt; supports-screens & gt; tag

Source: Internet
Author: User

Syntax:
<supports-screens android:resizeable=["true"| "false"]                  android:smallScreens=["true" | "false"]                  android:normalScreens=["true" | "false"]                  android:largeScreens=["true" | "false"]                  android:xlargeScreens=["true" | "false"]                  android:anyDensity=["true" | "false"]                  android:requiresSmallestWidthDp="integer"                  android:compatibleWidthLimitDp="integer"                  android:largestWidthLimitDp="integer"/>
Contained in:
<manifest>
Description:
Lets you specify the screen sizes your application supports and enable screen compatibility mode for screenslarger than what your application supports. it's important that you always use this element in yourapplication to specify the screen sizes your application supports.

An application "supports" a given screen size if it resizes properly to fill the entire screen. normal resizing applied by the system works well for most applications and you don't have to do anyextra work to make your application work on screens larger than a handset device. however, it 'soften important that you optimize your application's UI for different screen sizes by providing alternativelayout resources. for instance, you might want to modify the layout of an activitywhen it is on a tablet compared to when running on a handset device.

However, if your application does not work well when resized to fit different screen sizes, youcan use the attributes of<supports-screens>Element to control whether yourapplication shoshould be distributed to smaller screens or have its UI scaled up ("zoomed") to fitlarger screens using the system's screen compatibility mode. when youhave not designed for larger screen sizes and the normal resizing does not achieve the appropriateresults, screen compatibility mode will scale your UI by emulatingNormalSizescreen and medium density, then zooming in so that it fills the entire screen. Beware that thiscauses pixelation and blurring of your UI, so it's better if you optimize your UI for largescreens.

Note:Android 3.2 introduces new attributes:android:requiresSmallestWidthDp,android:compatibleWidthLimitDp, Andandroid:largestWidthLimitDp. If you're developing your application for Android 3.2 and higher, you should use these attributes to declare your screen size support, instead of the attributesbased on generalized screen sizes.

For more information about how to properly support different screen sizes so that you can avoidusing screen compatibility mode with your application, readSupporting Multiple Screens.

Attributes:
android:resizeable
Indicates whether the application is resizeable for different screen sizes. This attribute istrue, by default. If set false, the system will run your application in screen compatibility mode on largescreens.

This attribute is deprecated. It was introduced to help applicationstransition from Android 1.5 to 1.6, when support for multiple screens was first introduced. youshocould not use it.

android:smallScreens
Indicates whether the application supports smaller screen form-factors. A small screen is defined as one with a smaller aspect ratio than the "normal" (traditional HVGA) screen. an application that does not support small screens Will not be availableFor small screen devices from external services (such as Google Play), because there is littlethe platform can do to make such an application work on a smaller screen. This is "true"Bydefault.
android:normalScreens
Indicates whether an application supports the "normal" screen form-factors. traditionally this is an HVGA medium density screen, but WQVGA low density and WVGA high density are also considered to be normal. this attribute is "true" by default.
android:largeScreens
Indicates whether the application supports larger screen form-factors. A large screen is defined as a screen that is significantly larger than a "normal" handset screen, and thus might require some special care on the application's part to make good use of it, though it may rely on resizing by thesystem to fill the screen.

The default value for this actually varies between some versions, so it's better ifyou explicitly declare this attribute at all times. Beware that setting it "false" willgenerally enable screencompatibility mode.

android:xlargeScreens
Indicates whether the application supports extra large screen form-factors. an xlarge screen is defined as a screen that is significantly larger than "large" screen, such as a tablet (or something larger) and may require special care on the application's part to make good use of it, though it may rely on resizing by thesystem to fill the screen.

The default value for this actually varies between some versions, so it's better ifyou explicitly declare this attribute at all times. Beware that setting it "false" willgenerally enable screencompatibility mode.

This attribute was introduced in API level 9.

android:anyDensity
Indicates whether the application provided des resources to accommodate any screen density.

For applications that support Android 1.6 (API level 4) and higher, this is "true" by default andYou shoshould not set it "false"Unless you're absolutely certain thatit's necessary for your application to work. the only time it might be necessary to disable thisis if your app directly manipulates bitmaps (see the Supporting MultipleScreens document for more information ).

android:requiresSmallestWidthDp
Specifies the minimum smallestWidth required. The smallestWidth is the shortest dimension ofthe screen space (in dpUnits) that must be available to your application UI-that is, the shortest of the available screen's two dimensions. so, in order for a device to be consideredcompatible with your application, the device's smallestWidth must be equal to or greater than thisvalue. (Usually, the value you supply for this is the "smallest width" that your layout supports, regardless of the screen's current orientation .)

For example, a typical handset screen has a smallestWidth of 320dp, a 7 "tablet has asmallestWidth of 600dp, and a 10" tablet has a smallestWidth of 720dp. these values are generallythe smallestWidth because they are the shortest dimension of the screen's available space.

The size against which your value is compared takes into account screen decorations and systemUI. for example, if the device has some persistent UI elements on the display, the system declaresthe device's smallestWidth as one that is smaller than the actual screen size, accounting for theseUI elements because those are screen pixels not available for your UI. thus, the value you useshocould be the minimum width required by your layout, regardless of the screen's currentorientation.

If your application properly resizes for smaller screen sizes (down toSmallSize or a minimum width of 320dp), you donot need to use this attribute. otherwise, you shocould use a value for this attribute thatmatches the smallest value used by your application for the smallest screen width qualifier (sw<N>dp).

Caution:The Android system does not pay attention to thisattribute, so it does not affect how your application behaves at runtime. instead, it is usedto enable filtering for your application on services such as Google Play. however,Google Play currently does not support this attribute for filtering(On Android3.2), so you shoshould continue using the other size attributes if your application does not supportsmall screens.

This attribute was introduced in API level 13.

android:compatibleWidthLimitDp
This attribute allows you to enable screen compatibility mode as auser-optional feature by specifying the maximum "smallest screen width" for which your applicationis designed. if the smallest side of a device's available screen is greater than your value here, users can still install your application, but are offered to run it in screen compatibility mode. bydefault, screen compatibility mode is disabled and your layout is resized to fit the screen asusual, but a button is available in the system bar that allows the user to toggle screencompatibility mode on and off.

If your application is compatible with all screen sizes and its layout properly resizes, you donot need to use this attribute.

Note:Currently, screen compatibility mode emulates only handsetscreens with a 320dp width, so screen compatibility mode is not applied if your valueandroid:compatibleWidthLimitDpIs larger than 320.

This attribute was introduced in API level 13.

android:largestWidthLimitDp
This attribute allows you to force-enable screen compatibility mode by specifyingthe maximum "smallest screen width" for which your application is designed. if the smallest side ofa device's available screen is greater than your value here, the application runs in screencompatibility mode with no way for the user to disable it.

If your application is compatible with all screen sizes and its layout properly resizes, you donot need to use this attribute. Otherwise, you showould first consider usingandroid:compatibleWidthLimitDpAttribute. You shocould useandroid:largestWidthLimitDpAttribute only when your application is functionally broken whenresized for larger screens and screen compatibility mode is the only way that users shoshould useyour application.

Note:Currently, screen compatibility mode emulates only handsetscreens with a 320dp width, so screen compatibility mode is not applied if your valueandroid:largestWidthLimitDpIs larger than 320.

This attribute was introduced in API level 13.

Introduced in:
API Level 4
See also:
  • Supporting MultipleScreens
  • DisplayMetrics

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.