Flex mobile applicationdpi adaptive

Source: Internet
Author: User

Source: http://help.adobe.com/zh_CN/flex... cf5976c17-8000.html
In a mobile appProgramSupports multiple screen sizes and DPI values

 

Resolution is the value obtained by multiplying the pixel height by the pixel width, that is, the total number of pixels supported by the device.

DPI is the number of points per square inch, that is, the pixel density on the device screen. Terms DPI and PPI can be used interchangeably.

Flex DPI support

The following flex functions simplify the process of generating applications with no resolution or DPI.

Appearance the appearance of the mobile phone component related to DPI. No additional settings are required for the default phone appearanceCodeTo scale normally according to the resolution of most devices.
Applicationdpi this attribute is used to define the design size of a custom appearance. Assume that this attribute is set to a certain DPI value. When a user runs an application on a device with different DPI values, flex scales all content in the application according to the DPI of the device in use.
Whether or not the DPI scaling function is available, the default mobile phone appearance is independent of DPI. Therefore, if a component with a static size or custom appearance is not used, you do not need to set the applicationdpi attribute.

Dynamic Layout

Dynamic Layout helps you adapt to different resolutions. For example, if you set the control width to 100%, the screen width is always filled, regardless of whether the screen resolution is 480X854 or 480x800.

Set applicationdpi attributes

When setting a density-independent application, you can set the target DPI on the root application tag. (For mobile apps, the root tag is <s: viewnavigatorapplication>, <s: tabbedviewnavigatorapplication>, or <s: applica ion> .)

You can set the value of the applicationdpi attribute to 160, 240, or 320, depending on the approximate resolution of the target device.

 

 <S: Image id = "myimage"> 
<S: Source>
<S: multidpibitmapsource
Source160dpi = "assets/low-res/bulldog.jpg"
Source240dpi = "assets/MED-Res/bulldog.jpg"
Source320dpi = "assets/high-res/bulldog.jpg"/>
</S: Source>
</S: Image>

<S: button id = "dogbutton" Click = "dosomething ()">
<S: icon>
<S: multidpibitmapsource id = "dogicons"
Source160dpi = "@ embed ('HTTP: // www.cnblogs.com/assets/low-res/bulldog.jpg ')"
Source240dpi = "@ embed ('HTTP: // www.cnblogs.com/assets/med-res/bulldog.jpg ')"
Source320dpi = "@ embed ('HTTP: // www.cnblogs.com/assets/high-res/bulldog.jpg')"/>
</S: icon>
</S: button>

 

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.