简体   繁体   English

我如何在Android中使用相同的图像为不同的屏幕尺寸?

[英]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.

相关问题 如何在Android中创建不同的屏幕尺寸图像 - How can I create different screen size image in android 如何在Android中为不同的屏幕尺寸设置分辨率 - How can I set the resolution for the different screen size in android Android studio 我如何才能对所有屏幕进行图像大小 - Android studio how can i image size all screen 我应该如何在 Android 应用程序中调整我的微调器图像大小以适应不同的屏幕大小/分辨率? - How should I size my Spinner Image Size in Android app for different screen size/resolutions? 如何在任何屏幕尺寸上始终以相同的比例显示Android View的位置和尺寸? - How can I make Android View position and size be shown always with the same proportion on any screen size? Android中的图标和启动画面支持哪些格式? 我还可以为所有屏幕使用最大尺寸图像吗? - Which formats are supported for icon and splash screen in Android ? Also can i use max size image for all the screens? Android:如何以编程方式显示不同屏幕分辨率/大小的图像 - Android: How to display IMAGE for Different screen resolutions/size programmatically 如何在 Android 中为不同的内容使用相同的 Activity? - How can I use the same Activity for different content in Android? 我如何支持相同的屏幕尺寸但不同的dpi? - How do I support same screen size but different dpi? 如何在 android 设备中使用不同的屏幕尺寸特定值 - How to use different screen size specific values in android devices
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM