简体   繁体   中英

how can i use same image for different screen size in android?

I have an app which i want to show an image inside the image view inside an activity. I use a 160 dip for image height and I want to image fit across device screen . I can use "xxxhdpi" , "xxhpi" , for different screen size but this make my application size very big. I want to support screen size like 1440*2560 with 480 dip. i should use an image size like 1440*640 and put in "xxxhdpi" drawable folder .

试试这个:使用这个https://romannurik.github.io/AndroidAssetStudio/nine-patches.html链接和生成器图像进行多个屏幕

You can put a version of your image that is big enough and fitXY it in your ImageView. This way it stretches to the ImageView size.

If your images are simple icons you can consider using SVG images. You can convert svg images into android xml code using this link enter link description here

This way you don't have to be worry about the resolution of device.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM