How to support extra large screens in Android?

2019-04-08 14:18发布

According to this doc page, Android 2.3 supports extra large screen sizes (xlarge), and you can declare that your apps supports this size by adding android:xlargeScreens="true" in the <supports-screens> tag in the Manifest file.

But, since my app is targeted for a minimum SDK version of Android 2.1, compilation fails complaining about unknown attribute.

I don't want to use the new SDK because I won't get warnings if I accidentally use 2.3 specific features.

Is there a way out?

3条回答
爷的心禁止访问
2楼-- · 2019-04-08 14:34

You'll have to use the 2.3 SDK because that attribute simply is not known in lower SDKs. However, what you can do is set your target SDK to be 2.1.

查看更多
干净又极端
3楼-- · 2019-04-08 14:34

This worked for me like a charm.

<supports-screens
    android:largestWidthLimitDp="320"
    android:smallScreens="true"
    android:normalScreens="true"
    android:largeScreens="true"        
    android:xlargeScreens="true"/>

Refer here for more assistance.

查看更多
够拽才男人
4楼-- · 2019-04-08 14:35

It looks like that element is only supported for Android 2.3. As per the docs here:

Note: Android 2.3 (API Level 9) introduced a new attribute for the element: xlargeScreens

I believe that means that you can't, in fact, use that attribute unless you're compiling for Android 2.3.

查看更多
登录 后发表回答