如何使用Android的9补丁图像不同-2密度(如MDPI,LDPI,华电国际)。? [英] How to use 9 patch images in android for different-2 densities(like mdpi,ldpi,hdpi).?

查看:108
本文介绍了如何使用Android的9补丁图像不同-2密度(如MDPI,LDPI,华电国际)。?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创造的,我想多屏Android应用程序support.For这些我已经使用了9片图像。

I am creating an android application in which I want multiple screen support.For these I have used 9 patch images.

不过,我的问题是,这是否使用9片图像就知足了不同-2密度的设备或者我需要为不同的密度(如MDPI,LDPI,华电国际)创建不同的-2 9片图像。

But my question is this whether using 9 patch images will be enough for different-2 density's devices or I will need to create different-2 9 patch images for varying densities(like mdpi,ldpi,hdpi).

在此先感谢

推荐答案

我最近发现自己在同样的情况,所以让我全情投入和扩大已经取得说过......

I recently found out myself in the same situation so let me pitch in and expand on what has been said already...

是,9片图像将缩放,这就是他们的存在的东西。但是,如果你要使用9片图像所有的屏幕密度,这取决于在图像上真的。 9-补丁图像被更常用的,例如,按钮。你可以在你的应用程序不同大小的按钮和一个9修补形象,有利于对付他们,无论你如何调整您按钮(只要9片图像被正确创建)。

Yes, 9-patch images will scale, that's what they exist for. But if you should use a 9-patch image for all screen densities, that depends on the image really. 9-patch images are more commonly used, for instance, buttons. You can have different sized buttons in your app and a 9-patch image will help deal with them, no matter how you size your button (as long as the 9-patch image is properly created).

但是,假设你的按钮设计有一些非常圆角的华电国际版本。您可以创建9片图像不搞乱角落,但是当你看到它在LDPI版本,你会发现你的角落太大了分辨率较低。对于这种情况,你需要一个不同的9片图像较少的圆角,看起来就该决议更好。

But let's say your button design has some really round corners for the hdpi version. You create your 9-patch image without messing the corners but when you look at it in the ldpi version, you'll realize your corners are too big for that low resolution. For this situation, you'll need a different 9-patch image with less round corners, that look better on that resolution.

所以,最后的答案是,这取决于你的形象。如果你可以创建一个9片图像,看起来在所有的密度好,比精细,使用它,因为你只需要一个图像来处理所有的密度。但是,如果它不看,因为弯道,坡度,还是不错的,什么的,比你需要一个9片图像的每个屏幕密度。

So, the final answer is, it really depends on your image. If you can create a 9-patch image that looks good in all densities, than fine, use it, as you only need one image to handle all densities. But if it doesn't look good, because of corners, gradients, or whatever, than you'll need one 9-patch image for each screen density.

我希望它更清晰了。

这篇关于如何使用Android的9补丁图像不同-2密度(如MDPI,LDPI,华电国际)。?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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