开发者

Android Photoshop PNG Icons appear large and stretched

开发者 https://www.devze.com 2023-01-23 06:36 出处:网络
I am developing for the Android.When I create icons in Photoshop (and convert them to PNG), they appear larger and stretched within my Android application.The emulator that I am using is medium densit

I am developing for the Android. When I create icons in Photoshop (and convert them to PNG), they appear larger and stretched within my Android application. The emulator that I am using is medium density. Does anyone have some tips for how I can creat开发者_运维技巧e my icons in Photoshop so that they appear normally on the Android?

Thanks!


The dpi of the PNG isn't relevant in this instance, only the actual pixel size. How are you displaying the images? If you're using an ImageView, try setting android:scaleType="none". If you're setting its width and height with wrap_content it shouldn't matter, but it's worth a try.

Also, if you're accessing them from the drawables folder, try placing them under a new folder called drawable-mdpi. Android should detect that the emulator is set to medium density, and automatically use the resources from the mdpi folder if they exist.


PNGs can store pixel size information (dpi). That's probably why you see the image larger and streched.

Check Photoshop's image size options, if necessary fix the print sizes so aspect ratio is conserved.


I also have this problem. I don't know why. I am using Mac. The png file produces by it is extremely large. For example, the normal size should be 8kb, but it's size is 48kb. If a use other editor to edit & save them, the size return OK. Seems that ps is saving some extra info into the png file.

0

精彩评论

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