不同大小的图像(具有相同名称)在一个可拉伸夹 [英] Different sized images (with the same name) in one drawable folder

查看:228
本文介绍了不同大小的图像(具有相同名称)在一个可拉伸夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的Andr​​oid编程和每一个有点相似的问题是三年前左右,并没有真正回答我的问题。 Android的工作室曾经有过不同的DPI不同的绘制文件夹。现在只有一个。所以,如果我有两个名称相同的图像,但针对不同的DPI,我在哪里添加它们,以便在运行时手机可以使用适当的形象呢?

此外,大多数Android手机现在xhdpi或xxhdpi - 我真的需要包括不到任何图像?而究竟如何我会做到这一点?说,例如,我得到的图像关闭存在Shutterstock。我该如何使它所以它正常为xhdpi和xxhdpi?


解决方案

  

Android的工作室曾经有过不同的DPI不同的绘制文件夹。


它仍然如此。


  

现在只有一个


没有,有几个。然而,在Android的项目视图,它们显示在折叠状态:

如果您改变对下拉左上角的屏幕截图,以项目,你会得到你正在使用的观点,即反映了文件系统的:


  

所以,如果我有两个名称相同的图像,但针对不同的DPI,我在哪里运行系统手机可以使用适当的图像过程中添加他们如此?


在同一个地方像以前一样。就个人而言,我找到了Android的项目视图是奇没用,所以我切换到项目视图的第一件事,当我打开该项目。


  

大多数Android手机现在xhdpi或xxhdpi


没有,现在,只有约三分之一是


  

我真的需要包括任何图像小于?


我会的。如果你有一个可绘制数不​​胜数,欢迎您与具有更少的密度进行试验,但你要测试的密度降低,以确认您可绘制的下采样是谈到了确定。

I'm new to android programming and every single somewhat-similar question is from three or so years ago and doesn't really answer my question. Android Studio used to have different drawable folders for different dpi. Now there is only one. So if I have two images with the same name but for different dpi, where do I add them so that during runtime the phone can use the appropriate image?

Also, most android phones now are xhdpi or xxhdpi--do I really need to include any images less than that? And how exactly would I do that? Say, for example, that I get an image off shutterstock. How do I make it so it works correctly for both xhdpi and xxhdpi?

解决方案

Android Studio used to have different drawable folders for different dpi.

It still does.

Now there is only one.

No, there are several. However, in the "Android" project view, they are shown in a collapsed state:

If you change the drop-down towards the top-left of that screenshot to "Project", you will get the view that you are used to, that mirrors the filesystem:

So if I have two images with the same name but for different dpi, where do I add them so that during runtime the phone can use the appropriate image?

The same place as before. Personally, I find the "Android" project view to be singularly useless, and so I switch to the "Project" view as one of the first things when I open the project.

most android phones now are xhdpi or xxhdpi

No, right now, only about a third are.

do I really need to include any images less than that?

I would. If you have a zillion drawables, you are welcome to experiment with having fewer densities, but you will want to test the lower densities to confirm that the downsampling of your drawables is turning out OK.

这篇关于不同大小的图像(具有相同名称)在一个可拉伸夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆