[英]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 .
我使用160度图像高度,我想在设备屏幕上进行图像拟合。 I can use "xxxhdpi" , "xxhpi" , for different screen size but this make my application size very big.
我可以使用“xxxhdpi”,“xxhpi”,用于不同的屏幕尺寸,但这使我的应用程序大小非常大。 I want to support screen size like 1440*2560 with 480 dip.
我想支持屏幕尺寸,如1440 * 2560,480倾角。 i should use an image size like 1440*640 and put in "xxxhdpi" drawable folder .
我应该使用像1440 * 640的图像大小,并放入“xxxhdpi”drawable文件夹。
试试这个:使用这个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. 您可以放置一个足够大的图像版本,并在ImageView中使用它。 This way it stretches to the ImageView size.
这样它就会延伸到ImageView大小。
If your images are simple icons you can consider using SVG images. 如果您的图像是简单的图标,您可以考虑使用SVG图像。 You can convert svg images into android xml code using this link enter link description here
您可以使用此链接将svg图像转换为android xml代码, 在此处输入链接描述
This way you don't have to be worry about the resolution of device. 这样您就不必担心设备的分辨率。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.