Android Studio drawable folders

2019-01-17 13:47发布

In Android Studio, I can't figure out where to put images to be used inside the app. The drawable folder isn't broken down into drawable-hdpi, drawable-ldpi, etc. I saw another question asking this and the answer was to switch to Project view instead of Android view but drawable is only one folder there too. There is mipmap-hdpi, mipmap-ldpi, etc, but people are saying that's only for app icons. I'm confused.

8条回答
孤傲高冷的网名
2楼-- · 2019-01-17 14:08

Actually you have selected Android from the tab change it to project.

Steps

enter image description here

Then you will found all folders.

enter image description here

查看更多
做自己的国王
3楼-- · 2019-01-17 14:08

There are two cases:

  1. If you are having a single image, irrespective of device version, then you should put your images in drawable folder.

  2. But for the images that you created separately for hdpi, ldpi, mdpi, xhdpi, xxhdpi and xxxhdpi, depending on screen resolution of the mobile that will be using the app, you have to puy them in drawable-hdpi, drawable-ldpi, drawable-mdpi, drawable-xhdpi, drawable-xxhdpi and drawable-xxxhdpi folders respectively.

For the first case, if there is a single image, you can pretty much place it in any drawable folder, but its standard convention to put them in drawable folder.

查看更多
我只想做你的唯一
4楼-- · 2019-01-17 14:09

This tool creates the folders with the images in them automatically for you. All you have to do is supply your image then drag the generated folders to your res folder. http://romannurik.github.io/AndroidAssetStudio/

All the best.

查看更多
做个烂人
5楼-- · 2019-01-17 14:26

Its little tricky in android studio there is no default folder for all screen size you need to create but with little trick.

  • when you paste your image into drawable folder a popup will appear to ask about directory
  • Add subfolder name after drawable like drawable-xxhdpi
  • I will suggest you to paste image with highest resolution it will auto detect for other size.. thats it next time when you will paste it will ask to you about directory

i cant post image here so if still having any problem. here is tutorial..

Drawable folder in android studio

查看更多
等我变得足够好
6楼-- · 2019-01-17 14:30

In Android Studio 1.2.1.1

Just copy the image and paste the image into the app > res > drawable folder and it will shows you "Choose Destination Directory" popup screen as shown below screen

enter image description here

Now you can select option whatever resolution you want to place and if you want to view the those image into the folders then simply right click on the drawable folder > select copy paths option and open it. It will help you.

查看更多
爷、活的狠高调
7楼-- · 2019-01-17 14:31

If you don't see a drawable folder for the DPI that you need, you can create it yourself. There's nothing magical about it; it's just a folder which needs to have the correct name.

查看更多
登录 后发表回答