开发者

How do you prepare an image for a smaller density screen?

I initially built an Android app and threw all of my images in the drawable-hdpi resource directory and now I'm going back and making the necessary changes/additions so that the app is supported on all screen sizes and densities.

How do I go about taking all of my images and making them 开发者_JAVA技巧'less dense'? My first guess is to load them into Gimp or Photoshop and scale them down to a smaller resolution. Is this all I need to do?

How do you prepare an image for a smaller density screen?


How do I go about taking all of my images and making them 'less dense'? My first guess is to load them into Gimp or Photoshop and scale them down to a smaller resolution. Is this all I need to do?

Yes, that's all. The scaling performed by such programs is way better looking than Android's automatic scaling.

The dpi values are:

  • ldpi = 120 dpi
  • mdpi = 160 dpi
  • hdpi = 240 dpi

so if you have hdpi images you can scale them to 66% and obtain mdpi images, or 50% to get ldpi images.


Check out the docs about adapting your image to different screen sizes and densities. Also check out the UI Guidlines for icons and such. It gives you exact pixel width by height of an image in the different screen densities. This gives EXACT pixel densities. You have to scale down your image and put it in a different folder in your res directory, in your case: put it in the drawable-ldpi folder in res

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜