简体   繁体   English

其中drawable-hdpi,drawable-mdpi,drawable-xhdpi和drawable-xxhdpi。 走?

[英]where drawable-hdpi ,drawable-mdpi ,drawable-xhdpi and drawable-xxhdpi. go?

在此处输入图片说明

before when I was creating a new project I was found this folders drawable-hdpi,drawable-mdpi, drawable-xhdpi, and drawable-xxhdpi. 在创建新项目之前,我发现此文件夹为drawable-hdpi,drawable-mdpi,drawable-xhdpi和drawable-xxhdpi。 but now they are all gone! 但是现在他们都消失了!

is there any explanation of what happens? 有什么解释吗?

and where we should put our images? 以及我们应该在哪里放置图片?

This is perhaps because they will add an Gradle plugin that converts SVGs to PNGs during build (as mentioned in this IO talk ). 这也许是因为他们将添加一个Gradle插件,以便在构建过程中将SVG转换为PNG(如本IO讨论中所述 )。 The idea is that you will only need to have a single SVG instead of multiple PNGs for various densities (an thus, only one drawable folder). 这个想法是,您只需要一个SVG即可,而不必为各种密度使用多个PNG(因此,只有一个可绘制文件夹)。 You can still create the folders and use PNGs. 您仍然可以创建文件夹并使用PNG。

The Gradle plugins for SVG conversion by Google has not been released yet, but you can use Victor or a similar plugin if you already want to use SVGs for your drawables. Google尚未推出用于SVG转换的Gradle插件,但是如果您已经想将SVG用于可绘制对象,则可以使用Victor或类似的插件。

You should read Android Blog 您应该阅读Android博客
you can just create drawable-xhdpi. 您可以只创建drawable-xhdpi。

I just give answer here 我在这里给答案
read and if any problem ask. 阅读,如有问题请询问。

I wasn't aware that Android Studio ever provided these dpi dependent drawable folders for the built-in default project scaffolding, and indeed, why should they? 我不知道Android Studio曾经为内置的默认项目脚手架提供过这些与dpi相关的可绘制文件夹,实际上,为什么要使用它们呢?

Are they supposed to guess that you're going to support each and every one of these resolutions? 他们是否应该猜测您将支持这些决议中的每一项? Perhaps all your graphics will be vector graphics? 也许您所有的图形都是矢量图形? Perhaps you only target low or high resolutions? 也许您只针对低分辨率或高分辨率?

Also, the DPI modifier is only 1 of the possible modifiers you can attach to a resource folder. 同样,DPI修改器只是可以附加到资源文件夹的可能修改器之一。 You can also add locale, screen width / height, mobile country code and many more. 您还可以添加区域设置,屏幕宽度/高度,移动国家/地区代码等。 Should Android Studio create a folder with each of these options, along with every possible variation? Android Studio是否应该使用每个选项以及每个可能的变体创建一个文件夹? You'd end up with thousands of folders which you'd likely never use. 您最终将拥有成千上万个永远不会使用的文件夹。

In addition, creating a folder with no assets inside it is a big problem when you start synchronising your code using Github or something similar, and creating every possible folder with default assets inside seems like a huge waste. 此外,当您开始使用Github或类似工具来同步代码时,创建一个没有资产的文件夹是一个大问题,而创建每个可能带有默认资产的文件夹似乎是一个巨大的浪费。

I think the best approach here is to create any resource folder you need when you need it. 我认为最好的方法是在需要时创建所需的任何资源文件夹。 Google leaves this decision to you. Google将这项决定留给您。

Also, important: There is no XDPI or XXDPI folder - it's X H DPI, and XX H DPI 另外,重要的是:没有XDPI或XXDPI文件夹-它是X H DPI和XX H DPI

签入您的项目部分,不在Android部分中,如果它们消失了,只需创建它们

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

相关问题 我是否需要使用所有drawable,drawable-mdpi,drawable-hdpi,drawable-xhdpi,drawable-xxhdpi和drawable-xxxhdpi? - Do I need to use all of drawable, drawable-mdpi, drawable-hdpi, drawable-xhdpi, drawable-xxhdpi & drawable-xxxhdpi? Drawable-hdpi,Drawable-mdpi,Drawable-ldpi Android - Drawable-hdpi, Drawable-mdpi, Drawable-ldpi Android Android:Drawable-hdpi,Drawable-mdpi,Drawable-ldpi? - Android : Drawable-hdpi, Drawable-mdpi, Drawable-ldpi? 我对drawable-hdpi和drawable-mdpi很困惑 - I am confused with drawable-hdpi and drawable-mdpi 解释drawable,drawable-ldpi,drawable-mdpi和drawable-hdpi之间的区别 - Explain the difference between drawable, drawable-ldpi, drawable-mdpi and drawable-hdpi drawable-sw720dp与drawable-hdpi,drawable-xhdpi等 - drawable-sw720dp vs drawable-hdpi, drawable-xhdpi and others 如何使用res文件夹的drawable-hdpi,drawable-mdpi,drawable-ldpi中存在的图像? - how to use images present in drawable-hdpi,drawable-mdpi,drawable-ldpi of res folder? 图像大小(drawable-hdpi/ldpi/mdpi/xhdpi) - image size (drawable-hdpi/ldpi/mdpi/xhdpi) 可绘制尺寸:LDPI,MDPI,HDPI,XHDPI,XXHDPI,XXXHDPI? - Sizes for drawable: LDPI, MDPI, HDPI, XHDPI, XXHDPI, XXXHDPI? 如何使用 drawable 兼容所有屏幕尺寸(idpi、mdpi、hdpi、xhdpi、xxhdpi) - how to use drawable to compatible with all screen sizes (idpi, mdpi, hdpi, xhdpi, xxhdpi)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM