简体   繁体   English

Android Studio添加图像

[英]Android Studio Adding Images

I am new to android studio. 我是android studio的新手。 Can any one tell me what is the best way to add images as in eclipse? 谁能告诉我添加图像的最佳方法是什么? We have different folder like mdpi, xdpi .. Can any one tell me what is the best way to add images and size also? 我们有不同的文件夹,例如mdpi,xdpi ..谁能告诉我添加图像和尺寸的最佳方法是什么?

 I am trying with new->image asset but is this right way? what should be image size 

.. as in eclipse we are adding directly to res->mdpi,xdpi ..与eclipse中一样,我们直接将其添加到res-> mdpi,xdpi

What size should i take? 我应该选择多大的尺寸? What is asset type in that tool it giving only 3 option ie icon, action and tab, notification which one to be take? 该工具中的资产类型是什么,它仅提供3个选项,即图标,操作和选项卡,通知哪个选项要使用?

Just copy the image: 只需复制图像:

在此处输入图片说明

and paste it into drawable: 并将其粘贴到drawable中:

在此处输入图片说明

You can also drag and drop. 您也可以拖放。

Now, for different sizes, just make a folder with the appropriate names. 现在,对于不同的大小,只需使用适当的名称创建一个文件夹。 Go into project view first : 首先进入项目视图

在此处输入图片说明

Then, see these little folders in the res? 然后,在res中看到这些小文件夹?

在此处输入图片说明

Place each image into each folder. 将每个图像放入每个文件夹。 Here are the different size directories: 这是不同大小的目录:

drawable-mdpi for medium-density

drawable-hdpi for high-density

drawable-xhdpi for extra-high-density

drawable-xxhdpi for extra-extra-high-density

Thats it. 而已。

If this helped, make sure to accept it by pushing the checkmark. 如果这样做有帮助,请确保通过选中对勾来接受它。 If you have more questions, feel free to ask, I am happy to help! 如果您还有其他问题,请随时提出,我们很乐意为您服务!

Edit to question: 编辑问题:

320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).  
480dp: a tweener tablet like the Streak (480x800 mdpi).  
600dp: a 7” tablet (600x1024 mdpi).  
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).

You can directly Add your images in drawable folder OR If you have requirement for multi size images then use drawable size categories like. 您可以将图像直接添加到drawable文件夹中,或者如果需要多尺寸图像,则使用诸如drawable尺寸类别。

drawable-mdpi for medium-density drawable-mdpi用于中等密度

drawable-hdpi for high-density drawable-hdpi用于高密度

drawable-xhdpi for extra-high-density drawable-xhdpi用于超高密度

drawable-xxhdpi for extra-extra-high-density drawable-xxhdpi用于超高密度

It can be found in detail Here 可以在这里找到详细信息

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

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