简体   繁体   English

如何为不同的android屏幕尺寸使用矢量图像

[英]how to use vector images for different android screen sizes

how to use vector images which scale up and down according to the screen sizes? 如何使用根据屏幕尺寸缩放的矢量图像? I m using a vector image in my project but it is not scaling in big screens. 我在项目中使用了矢量图像,但它无法在大屏幕上缩放。

what you mean by being scaled ? 被缩放意味着什么? maybe you are misunderstanding. 也许你误会了。

if you mean the image size would be changed in various screen sizes such thing wont happen. 如果您的意思是图像大小将在各种屏幕尺寸中更改,则不会发生这种情况。 the image size is what you provide in your imageview (or any otherview using the image). 图像尺寸就是您在imageview(或使用该图像的任何其他视图)中提供的尺寸。

the only different between vector assets and normal asset is that vector asset are redrawn every time so you wont have a low quality image no matter how big it is and which device it is being shown in. so you wont need to save various size of image for various size of screens. 向量资产和常规资产之间的唯一区别是,向量资产每次都会重绘,因此无论图像多大以及显示在哪种设备上,您都不会得到低质量的图像。因此,您无需保存各种大小的图像适用于各种尺寸的屏幕。

if you want to change the size of image just change the imageView height and width. 如果要更改图像的大小,只需更改imageView的高度和宽度。 you can use dp (density independant) unit. 您可以使用dp(密度独立)单位。

you dont have to do anything for support vector images for diffrent screens its already scale for the relevant dp, Can you give more details about your problem when you say "it is not scaling in big screens?" 您不必为支持不同dp的不同屏幕的支持向量图像做任何事情,当您说“它不在大屏幕中缩放时”,是否可以提供有关问题的更多详细信息? maybe you want the image on tablets will be bigger? 也许您希望平板电脑上的图像更大?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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