How to add an image to the “drawable” folder in An

2019-01-03 20:35发布

I need to add an image to the res/drawable folder...

When I choose new > image asset, it comes out a dialog to choose Asset Type...

How can I add an image to res/drawable folder?

22条回答
我只想做你的唯一
2楼-- · 2019-01-03 21:12

Adding images to the drawable folder is pretty simple. Just follow these steps:

  1. Download the required image and save it on desktop.
  2. Now, go to Android Studio and right click on drawable inside res.
  3. On right clicking you will see 'Show in Explorer' or 'Reveal in Finder'.
  4. Click on 'Show in Explorer' or 'Reveal in Finder' and then drag or simply copy your downloaded image into drawable folder.

Your image will be saved inside drawable and you can use it.

查看更多
放我归山
3楼-- · 2019-01-03 21:12

In Android Studio

  1. Select Drawable folder, do Ctrl N Screenshot
  2. Select Image asset

  3. Select Action Bar & Tab icons in asset type

  4. Click Next

  5. Select size

  6. You're done!

查看更多
戒情不戒烟
4楼-- · 2019-01-03 21:13
  1. Open your project in Android Studio

  2. Click on res

  3. Right click on drawable

  4. Click on Show in Explorer

  5. Double click on drawable folder.

  6. Copy your image file in it and rename as your wish.

  7. Now write your image file name after @drawable/ .

It will show the image you've selected.

查看更多
家丑人穷心不美
5楼-- · 2019-01-03 21:15

Install and use the Android Drawable Importer plugin:

https://github.com/winterDroid/android-drawable-importer-intellij-plugin

Instructions on how to install the plugin are on that page. It's called "Android Drawable Importer" in the plugin search results.

Once installed:

  1. right click on "res" folder and select New -> Batch Drawable Import
  2. hit the + and select your source image
  3. choose what resolution you want it considered and which other sizes to auto-generate for

Seems kind of ridiculous that Android Studio doesn't support this directly.

EDIT: But Xcode doesn't either so.... :-(

查看更多
Bombasti
6楼-- · 2019-01-03 21:15

Just copy your images and select drawable then on the option of Paste or press shortcut ctrl v. images are added

查看更多
叛逆
7楼-- · 2019-01-03 21:16

You just have to copy the image file from your location folder and then right click on drawable in the android studio and then paste it.

查看更多
登录 后发表回答