简体   繁体   English

如何同时使用可绘制和可绘制hdpi中的资源?

[英]how to use resources from drawable and drawable-hdpi at the same time?

I have the following problem. 我有以下问题。 From what I have seen if I put my resources in the drawable folder the sdk will scale them automatically if I don't have the anyDensity option in the manifest, but this does not look good on the Galaxy Tab (the icons look too small). 从我看到的情况来看,如果我将资源放在drawable文件夹中,则如果清单中没有anyDensity选项,则sdk会自动缩放资源,但这在Galaxy Tab上看起来不太好(图标看起来太小) 。 I have some specific resources for the 320x480, 480x800, 600x1024. 我有一些针对320x480、480x800、600x1024的特定资源。 If i put them in the specific drawable folders and not set anyDensity to true they look too big. 如果我将它们放在特定的可绘制文件夹中,并且未将anyDensity设置为true,则它们看起来太大。 If I set anyDensity to true they seem to look ok. 如果我将anyDensity设置为true,则它们看起来还可以。 But the question is, if I don't have resources of different sizes for all the resources can i put some of them in the drawable folder (so the sdk makes the prescaling) and the other ones in the specific drawable folder or I need specific resources for all the resolutions and all the resources. 但是问题是,如果我没有所有资源的大小不同的资源,我可以将其中一些放置在drawable文件夹中(以便sdk进行预缩放),而将其他放置在特定的drawable文件夹中,或者我需要特定的所有决议和所有资源的资源。

Thank you. 谢谢。

Yes. 是。 Android will select the most appropriate version of the resource to use at runtime automatically. Android将选择最合适的资源版本以在运行时自动使用。 So if you having one version of a picture in the drawable folder, and another in the drawable-hdpi folder, then the app will use the hdpi version if the device has a hdpi screen. 因此,如果您在drawable文件夹中有一个图片版本,而在drawable-hdpi文件夹中有另一个图片版本,那么如果设备具有hdpi屏幕,则该应用程序将使用hdpi版本。 If not, it will default to the version in the drawable folder. 如果不是,它将默认为drawable文件夹中的版本。 Just make sure the different versions have exactly the same name and extension. 只要确保不同的版本具有完全相同的名称和扩展名即可。 If you only have one version of a picture, it will always use that version. 如果图片只有一个版本,它将始终使用该版本。 The -xxx extensions to folder names only override default resources. 文件夹名称的-xxx扩展名仅覆盖默认资源。

暂无
暂无

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

相关问题 Android 资源问题:如何获取 res/drawable-hdpi 文件夹的标识符? - Android resources problem: How to getIdentifier for a res/drawable-hdpi folder? Android:如何在drawable-hdpi中放置具有不同分辨率的相同图像 - Android: how to place same image with different resoultion in drawable-hdpi 如何使用res文件夹的drawable-hdpi,drawable-mdpi,drawable-ldpi中存在的图像? - how to use images present in drawable-hdpi,drawable-mdpi,drawable-ldpi of res folder? 如何将android位图别名为另一个大小的drawable(drawable-large-mdpi别名为drawable-hdpi) - How can I alias an android bitmap to a drawable from another size (drawable-large-mdpi aliases to drawable-hdpi) WebView如何获取本地res \\ drawable-hdpi图像路径 - WebView how to get local res\drawable-hdpi image path 如何打开JPG文件作为保存在…/ res / drawable-hdpi /中的BITMAP? - How to open a JPG file as a BITMAP stored on the …/res/drawable-hdpi/? 我无法从位于Android中drawable-hdpi的drawable设置drawable属性? - I cannot set drawable property from drawable located in drawable-hdpi in android? 从/ drawable-hdpi而不是/ drawable加载为背景时,不同大小的Drawable - Different size of Drawable when loaded as background from /drawable-hdpi instead of /drawable 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?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM