I'm in the process of up-scaling the graphics for my game for better display on higher density devices. I created the higher dpi artwork, added it to the correct place (res/layout/drawable-hdpi). I added the following to my manifest:
<supports-screens
android:smallScreens="false"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />
And it worked beautifully... with the exception of one image I forgot to upscale and was being pulled from drawable-mdpi. I upscaled that image, dropped it into drawable-hdpi and relaunched. Now the game is only pulling images from mdpi.
I can verify with git that the only change i made to the codebase since it was working is adding the new image file. For troubleshooting purposes I've tried both removing that added image and resetting my git repo to the state it was in when it worked. In both cases its still just always loading from mdpi. This leads me to believe it may be an issue with the emulator. I'm developing this in my car on a netbook, 开发者_StackOverflowwhich sometimes gives me issues with the emulator (usually takes an hour or so to boot and runs very, very sluggishly on the Atom).
Anyone have an idea as to what might be stopping the game from pulling from hdpi?
Edit
After a lot of troubleshooting I'm still no closer to solving this. It seems my app may be running in compatibility mode. It's not displaying "postage stamp" sized, it's using the whole wvga800 screen; but getDisplayMetrics().density returns 1.0. The emulator states it is set at High (240) dpi, so I'm assuming density should be > 1.0.
Random datapoint: Changing the drawable-hdpi directory to drawable-large causes the larger images to load. In that case getDisplayMetrics().density is still 1.0 so I can't do proper px->dp conversions.
res/layout/drawable-hdpi is not the correct location. res/drawable-hdpi is the correct location.
Check out my problem here
Android Eclipse emulator problem: Runs WVGA(hdpi) as a mdpi screen
The way I fix it is to delete the AVD and create a new one. I'm still trying to find an concrete answer to the problem. So far all you can do is restart the computer and/or make a new AVD.
精彩评论