여러 size screen 을 한 번에 지원하기
resource를 활용하기
android용을 여러 프로젝트로 구성하기
에 대한 정석 설명.
만약에 ant 같은 것을 쓰려면, command line build를 할 줄 알아야겠다.
문제가 있다.
screenSize 를 api level 9 부터 지원하네.
android 2.2는 api level 8 이다.
public static final int screenSize
Specifies a compatible screen size, as per the device configuration screen size bins.
Must be one of the following constant values.
| Constant | Value | Description |
|---|
small | 200 | A small screen configuration, at least 240x320db. |
normal | 300 | A normal screen configuration, at least 320x480db. |
large | 400 | A large screen configuration, at least 400x530db. |
xlarge | 500 | An extra large screen configuration, at least 600x800db. |
Constant Value: 16843466 (0x010102ca)
...
introduced in:API Level 9
어라 이상하다..
그런데, resource에서는 쓸 수 있나보다. api level 4 래. -0-
| Screen size | small
normal
large
xlarge | small: Screens that are of similar size to a low-density QVGA screen. The minimum layout size for a small screen is approximately 320x426 dp units. Examples are QVGA low density and VGA high density.normal: Screens that are of similar size to a medium-density HVGA screen. The minimum layout size for a normal screen is approximately 320x470 dp units. Examples of such screens a WQVGA low density, HVGA medium density, WVGA high density.large: Screens that are of similar size to a medium-density VGA screen. The minimum layout size for a large screen is approximately 480x640 dp units. Examples are VGA and WVGA medium density screens.xlarge: Screens that are considerably larger than the traditional medium-density HVGA screen. The minimum layout size for an xlarge screen is approximately 720x960 dp units. In most cases, devices with extra large screens would be too large to carry in a pocket and would most likely be tablet-style devices. Added in API level 9.
Note: Using a size qualifier does not imply that the resources are only for screens of that size. If you do not provide alternative resources with qualifiers that better match the current device configuration, the system may use whichever resources are the best match. Caution: If all your resources use a size qualifier that is larger than the current screen, the system will not use them and your application will crash at runtime (for example, if all layout resources are tagged with the xlargequalifier, but the device is a normal-size screen). Added in API level 4. See Supporting Multiple Screens for more information. Also see the screenLayout configuration field, which indicates whether the screen is small, normal, or large. |
좀 더 자세히 알아보니
Configuration config = getResources().getConfiguration();
config.screenLayout | android.content.res.Configuration.SCREENLAYOUT_SIZE_LARGE
과 같은 방식으로 값을 얻어낼 수 있기는 한데,
public static final int SCREENLAYOUT_SIZE_LARGE
Constant Value: 3 (0x00000003)
까지만 API level 4 에서 지원되고, 이것도 이미 해상도 기준으로 정해지는 size 인가보다.
xlarge는 API level 9 에서 들어왔다.
별로 쓸모가 없겠다.
최근 덧글