简体   繁体   English

'drawable'文件夹和'drawable-hdpi-ldpi-mdpi-xhdpi'文件夹之间有什么区别?

[英]What's differences between 'drawable' folder and 'drawable-hdpi-ldpi-mdpi-xhdpi' folders?

To have just 'drawable' folder(if doesn't exist, I create) is enough to create suitable image size rate for all devices? 只有'drawable'文件夹(如果不存在,我创建)足以为所有设备创建合适的图像大小率? or Should I create image size rate for each folder(hdpi, mdpi, ldpi, xhdpi) ? 或者我应该为每个文件夹(hdpi,mdpi,ldpi,xhdpi)创建图像大小率?

You can have drawables with the same filename in the different dawable-{}dpi folders. 您可以在不同的dawable - {} dpi文件夹中使用相同文件名的drawable。 Depending on the display density the drawables from the correpsonding folders are picked. 根据显示密度,拾取相应文件夹中的可绘制对象。

You can read up here 你可以在这里阅读

在此输入图像描述

res/drawable/ is equivalent to res/drawable-mdpi/ . res/drawable/相当于res/drawable-mdpi/ The suffix-less name is there for backwards compatibility, before the densities were added in Android 1.5 or thereabouts. 在Android 1.5或其附近添加密度之前,无后缀名称用于向后兼容。

is enough to create suitable image size rate for all devices? 足以为所有设备创建合适的图像大小率?

If you do not mind Android scaling your images up and down for other densities, yes. 如果您不介意Android将图像上下缩放以获得其他密度,是的。 Usually, the quality will degrade the further the density is from the starting point (in this case, -mdpi . 通常,密度从起点开始进一步降低质量(在这种情况下, -mdpi

Should I create image size rate for each folder(hdpi, mdpi, ldpi, xhdpi) ? 我应该为每个文件夹(hdpi,mdpi,ldpi,xhdpi)创建图像大小率吗?

That depends on the image and the results of the automatic scaling. 这取决于图像和自动缩放的结果。 Many developers will ship a couple of densities, but not all of them, and tending to aim towards higher densities (eg, -xhdpi ). 许多开发人员将提供几种密度,但不是所有密度,并倾向于以更高的密度为目标(例如, -xhdpi )。 But, you are welcome to do what you want, so long as you feel that your users will be comfortable with the image quality that you deliver to them. 但是,只要您认为您的用户对您提供的图像质量感到满意,欢迎您按照自己的意愿行事。

Almost every application should have alternative drawable resources for different screen densities, because almost every application has a launcher icon and that icon should look good on all screen densities. 几乎每个应用程序都应该有不同的可绘制资源用于不同的屏幕密度,因为几乎每个应用程序都有一个启动器图标,并且该图标应该在所有屏幕密度上都很好看。 Likewise, if you include other bitmap drawables in your application (such as for menu icons or other graphics in your application), you should provide alternative versions or each one, for different densities. 同样,如果在应用程序中包含其他位图drawable(例如应用程序中的菜单图标或其他图形),则应为不同的密度提供替代版本或每个版本。 Have a look at this link: http://developer.android.com/guide/practices/screens_support.html 看看这个链接: http//developer.android.com/guide/practices/screens_support.html

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

相关问题 可绘制ldpi / mdpi / hdpi / xhdpi文件夹的最佳位图大小是多少? - What is the optimal bitmap size for drawable ldpi / mdpi / hdpi / xhdpi folders? 可绘制尺寸:LDPI,MDPI,HDPI,XHDPI,XXHDPI,XXXHDPI? - Sizes for drawable: LDPI, MDPI, HDPI, XHDPI, XXHDPI, XXXHDPI? 图像大小(drawable-hdpi/ldpi/mdpi/xhdpi) - image size (drawable-hdpi/ldpi/mdpi/xhdpi) 如果为ldpi,mdpi,hdpi,xhdpi提供了可绘制资源,则不需要为nodpi提供可绘制资源吗? - If a drawable resource is provided for ldpi, mdpi, hdpi, xhdpi, this drawable does not need to provided for nodpi? 解释drawable,drawable-ldpi,drawable-mdpi和drawable-hdpi之间的区别 - Explain the difference between drawable, drawable-ldpi, drawable-mdpi and drawable-hdpi 避免多个可绘制集(hdpi / mdpi / ldpi) - Avoid Multiple Drawable Sets (hdpi/mdpi/ldpi) 如何使用res文件夹的drawable-hdpi,drawable-mdpi,drawable-ldpi中存在的图像? - how to use images present in drawable-hdpi,drawable-mdpi,drawable-ldpi of res folder? 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? 可绘制的mdpi / ldpi / hdpi应该是可绘制的普通/小/大? - drawable mdpi/ldpi/hdpi should be drawable normal/small/large?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM