开发者

Android Image Sizing

I am trying to make a tile game that has 6 tiles in each row. The tiles are a fixed size, 80x80 and fit snuggly on a 480x854 screen (since 6*80=480). I am trying to make sure that my application works for other densities/sizes, but the logic is confusing to me. What is the best way that I can be sure I h开发者_运维技巧andle other densities correctly? I've read http://developer.android.com/guide/practices/screens_support.html entirely, but am still confused. Even if I scale images for different densities, can't I still run into the problem that the screen won't have enough pixels to support my "6 tiles in a row"? As an example, let's say the device was 320x480, but also high density. No scaling would be done, and my 480px wouldn't fit on the 320px screen. I am trying to not hardcode for pixels, but don't see another option. Any input appreciated.


Assuming you are using ImageViews, you just need to make sure the images are large enough that they don't get blurred on larger screens and then set the correct scale type for each ImageView:

http://developer.android.com/reference/android/widget/ImageView.html#attr_android:scaleType

Android should handle the rest for you.


I've decided that I don't think there is an intended way to solve this problem. I will have to rely on the fact that there are only a few screen sizes right now and make a "best fit" for the common sizes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜