简体   繁体   English

如何将dpi响应图像添加到android studio?

[英]How to add dpi responsive images to android studio?

I am new to the android development environment. 我是android开发环境的新手。 I want to add an image into my application but with different dpi. 我想将图像添加到我的应用程序中,但使用不同的dpi。 If I go to drawable > new > Image Asset I can only add an icon for my app/menu button/notification icon. 如果转到“可绘制”>“新建”>“图像资产”,则只能为我的应用程序/菜单按钮/通知图标添加一个图标。 If I select the launcher icon, my image becomes way too small. 如果选择启动器图标,我的图像将变得太小。 If I click the menu bar menu, it becomes white. 如果单击菜单栏菜单,它将变为白色。 If I click notification, they're as tiny as an ant. 如果我单击通知,它们就像蚂蚁一样小。 Anyways, I was wondering if I can make android studio make the image responsive by adding differing dpis. 无论如何,我想知道是否可以使android studio通过添加不同的dpi来使图像响应。 like splash.png HDPI splash.png MDPI See what I mean? 像splash.png HDPI splash.png MDPI明白我的意思吗? I made a splashscreen but on different devices it's either too small/too big. 我制作了一个启动画面,但是在其他设备上,它太小/太大。

Note: PARDON ME IF THIS HAS BEEN ASKED BEFORE. 注意:如果之前已经提出过,请原谅。 I AM KINDA NEW 我是金达人

in your res folder there multiple folders for drawables drawable-mdpi drawable-hdpi drawable-xhdpi ... 在您的res文件夹中,有多个可绘制对象的文件夹drawable-mdpi drawable-hdpi drawable-xhdpi ...

if you want to add an image for hdpi devices add it into drawable-hdpi 如果要为hdpi设备添加图像,请将其添加到drawable-hdpi

Android Studio doesn't create folders for different dpi's by default. 默认情况下,Android Studio不会为不同的dpi创建文件夹。 So, you will need to create those folders yourself and add images to it. 因此,您将需要自己创建这些文件夹并向其中添加图像。 Just create folders such as drawable-hdpi, drawable-mdpi, and if you need drawable-xhdpi and so on. 只需创建诸如drawable-hdpi,drawable-mdpi之类的文件夹,以及是否需要drawable-xhdpi之类的文件夹。

If you are using Eclipse then those folders are created by IDE itself. 如果使用的是Eclipse,则这些文件夹将由IDE本身创建。

I hope this helps you out. 我希望这能够帮到你。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM