Android - Extra large images placed in res/drawabl

2019-07-18 05:05发布

问题:

My app seems to be working on different sized screens well, apart from the tablet sized screens.

The way I have worked, is using a relative layout, which has lots of images. The images then have different sizes put in the folders, which will be picked up depending on which images the phone use ( depending on size )

The folders I use are:

drawable-hdpi

drawable-mdpi

drawable-ldpi

^ These were already added when I created the project in eclipse.

I read, and added drawable-xhdpi with the expectation that the larger screens would use this. I then put the images in, and my layout looked tiny on the android 3.0 emulator. So, I then put a mark on one of the images in xhdpi, and found that the tablet emulator isn't actually using this images.

Any ideas why? Does something need to go in the manifest?

回答1:

This can sometimes happen with 'compatability mode'

http://developer.android.com/guide/practices/screen-compat-mode.html

You can declare that you support these extra large screens like this:

 <supports-screens android:xlargeScreens="true" />

or try declaring that you target SDK version 13, this will turn compatibility mode off. however this has other side-effects

 <uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="13" />

It's all documented in the above link



回答2:

xhdpi is "extra high DPI" (e.g. the Galaxy Nexus, small screen, big resolution), most tablets do not fit in this category. You're probably looking for drawable-xlarge.