Problems wih minSdkVersion 1.5

对着背影说爱祢 提交于 2019-12-03 03:28:06

If you specify targetSdkVersion as well as minSdkVersion your application will start to work correctly on all platforms.

So have an entry in your manifest like this:

<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4"/>

This is covered in the Android API Levels page in the Android Developer documentation.

I assume you're specifying different assets for different screen densities using directories like res/drawable-mdpi, res/drawable-hdpi and so on?

Android 1.6 (API level 4) was the first version of the SDK to support multiple screen densities, so it knows the significance of these directory names and so can successfully select the correct drawable from your res folders for the particular device it's running on.

However, if you run an application developed in this way on an Android 1.5 device (API level 3), then the framework does not know that it should only use the medium DPI resources (as there are no Android 1.5 devices released with anything other than medium DPI screens (AFAIK)). So in this case, the framework can end up choosing seemingly randomly from all the available resource in your APK, whether they're intended for high density screens or medium density screens, or whatever.

However, I haven't seen the reverse happening that you are, i.e. a 2.0 device appears to select drawables for, or assumes, a different screen density.

I would make sure your res directory layout is correct, and that you're using density-independent measurements in each of your layouts as appropriate.

But if you want to support multiple screen resolutions and densities and support Android 1.5 devices in a single APK, then I don't believe it's possible.

Mag

Add this tag in your AndroidManifest.xml to support multiple screen densities.

<supports-screens 
android:largeScreens="true" 
android:normalScreens="true" 
android:smallScreens="true" 
android:anyDensity="false" /> 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!