android Supporting multiple screen翻译(二)

慎建本
2023-12-01

How Android supports multiple screens

Using the alternative resources framework使用可选资源框架

The platform's support for loading screen size- and density-specific resources at run time is based on the alternative resources framework.

If you want to use size- or density-specific layouts or drawables in your application and you are not familiar with resource qualifiers or how the platform uses them, please read Alternative Resources.

    平台支持在运行时加载基于可选资源框架的多屏幕尺寸和特定密度的资源

如果你想要使用尺寸或者特定密度布局或者是可利用的应用程序,如果你不熟悉资源限定符或者是如何在平台上使用它们,请阅读Alternative Resources.

The foundation of Android's support for multiple screens is a set of built-in compatibility features that together manage the rendering of application resources in an appropriate way for the current device screen. The platform handles most of the work of rendering your application, but also gives you two key ways to control how your application is displayed, if you need or want to use them:

      Android起初支持多屏幕是在一组嵌入兼容装置同时用合适的方式管理当前装置的屏幕中应用程序资源的呈现

The platform supports a set of resource qualifiers that let you provide size- and density-specific resources, if needed. The qualifiers for size-specific resources are normal, and hdpi (high), ldpi (low). The qualifiers correspond to the generalized densities given in Table 1, above.

    。该平台支持一组让你提供尺寸和特定密度的资源限定符,如果需要,对特定资源的限定分为largenormalsmall,对特定密度资源的限定分为hdpihigh),ldpi (low),特定密度的限制符在上表1中已给出。

The platform also provides a android:largeScreens, android:smallScreens let you specify what generalized screen sizes your application supports. A fourth attribute, <supports-screens>,它的属性android:normalScreens, supports-screens element, the platform displays the application at the baseline size ("normal") and density ("medium). For screens larger than baseline, the platform displays the application in a baseline-sized portion of the overall screen, against a black background.

    如果当前屏幕的大小大于您的应用程序所支持的supports-screens元素中声明的尺寸,该平台会在基线尺寸(normal)和密度(medium)下显示应用程序,对于比基线大的屏幕,平台将会在整个屏幕的部分用基线尺寸来出现,而并不是用黑色背景。

For instance, suppose a given device is using a WVGA medium density screen, classified as a "large" screen, but the application states that it does not support large screens; in this case, the system will again "lie" to the application when it queries for screen dimensions, and report 320x480. Instead of scaling the application, however, the application's 320x480 interface will be placed as a "postage stamp" in the larger 480x800 screen.For more information, see the <FONT style="LAYOUT-GRID-MODE: both; FONT-SIZE: 14pt" color="#007000" face=""">android:anyDensity attribute in Manifest elements for screens support and the Screen-Compatibility Examples section.

    例如,假设一个给定的设备使用的是中密度的WVGA屏幕,作为一个“large”屏幕划分,但应用程序状态显示它不支持large屏幕,在这种情况下,当它查询屏幕尺寸时,系统将再次撒谎,并报告320x480。而不是缩放的应用程序,但是,该应用程序的320*480用户界面将会以“邮票”的方式放置在比较大的480*480的屏幕上。

In general, these compatibility features ensure that all applications, including those written against Android 1.5 and earlier platform versions, can display properly on most devices, especially when the device's screen is at the baseline "normal" size or larger.

    一般来说,这些兼容功能确保所有应用程序,包括对android1.5平台或者早期版本,都可以显示在大多数设备,特别是当设备的屏幕在基准是正常尺寸或者是large

However, note that applications written for the baseline screen may need minor adjustments before they display properly on smaller screens such as QVGA. With the reduced screen area of small screens, there may be tradeoffs in design, content, and function that you, as the application developer, need to consider. For more information about how to prepare an existing application for display on small screens, see Strategies for Legacy Applications.

  但是请注意,在它在诸如QVGA的小屏幕上合适的显示之前,应用程序对基线屏幕的书写需要一些小调整,随着小屏幕的屏幕面积减少,作为应用程序的开发者,有可能在设计、内容、函数上需要考虑调整,The sections below provide more information how to take advantage of the platform's multiple-screens support.

 

 

 

 

 

 类似资料: