How to create drawable folder in res? - android

I am trying to create drawable-hdpi drawable-xxhdpi drawable-ldpifolders for different screens but unable to create as it says the folders already exist but i can't see them also when trying to create drawable-xxhdpi folder on click nothing happens no folder's are create
Screenshots below
Can't see any drawable-xhdpi folder although it says it exist
Here on clicking OK nothing happens no folder is created

Yes it already exist.
you have to change the project structure
Click on top left dropdown where Android Appears.
Select project from this dropdown and you will be able to see all drawbale folders.

Its because you might not have any files inside your res/drawable-xxx folders
To access them, change your project navigation:
To do so, check the top left pane for some written as 1 Project click on that or alternatively press Alt+1 here, if you see the default selection will be Android with an android bot click on the two left-right arrow icons select Project Files and then navigate!

You do not need to explicitly create the drawable folders for different resolutions.
Whenever you will add any image to the project's drawable folder, by clicking right on the drawable folder and pasting the image there, a dialog will open up, that will ask you to select from drawable-hdpi, drawable-mdpi, drawable-xhdpi, and drawable-xxhdpi.
You can then select the suitable one from the drop down, and you will be able to see the distinctions within the drawable folder itself.

Related

No options appear when you paste a picture inside drawable folder?

When I paste an image or icon into the folder drawable Default choices do not appear Like : xxhdpi,xhdpi,hdpi or mdpi look at the picture :
I used the same method in previous times but Now these choices do not appear His method was very easy through selections xxhdpi,xhdpi,hdpi or mdpi in popup window But now what will I do?
I want to import the same icon But in different sizes , It is inside the drawable folder .
I want to show me such a list
You need to create all required folder manually.
like hdpi,mdpi,xhdpi,xxhdpi,xxxhdpi etc and then after that options appear.
If u have all folder types(drawable hdpi,drawable mdpi,drawable xhdpi,drawable xxhdpi,drawable xxxhdpi), just copy these folders, in res\ by right click on res folder and just paste, then android studio update drawable folder to new changes.

How to add the different density images under the drawable folder?

I am facing the issue in adding the different density images in drawable folder in android studio.
In the above image i added the images in drawable folder with single density image. I want to add the different density images in a single directory .In below image drawar_shadow.png directory has multiple density images.How can i create the directory like that and add the different density images.I searched in the stack overflow ,i didn't get any idea top solve this.
The drawar_shadow.png you are mentioning is in different folders on your filesystem in actual. This is Android Studio's way of showing it you. You can just add your images in respective folders and Android Studio will show them like this.
Select Project instead of Android in the top dropdown
go to res/ and create your folders with different density there.. OR simply you can use mipmap folder for this purpose
All or Correct Change the Project structure instead of Android Structure. Just your view display separate folder
For Others... add image with different density
button is pressed and select the picture and click ok
if u want change the directory edit button is press.
The easiest way I have found to have the proper "directory" structure appear under the drawable folder for my icons is this. Follow the steps:
Right click "Drawable"
Click on "New", then "Image Asset"
Change "Asset Type" to "Action Bar and Tab Icons"
For "Foreground" choose "ClipArt"
For "Clipart" click and "Choose" button and pick any icon
For "Resource Name" type in you icon file name
Now the pseudo-directories have been created for you under the "Drawable" folder inside the "res" in the Android view.
To add new icons just copy and paste them in drawable the popup will appear showing the different options select according to your need and add.

Add images from folder in Android Studio?

I have a file with a bunch of images saved on my computer that I need to use for an app I'm creating. I've searched for how to do this, but most everything leads nowhere. The most promising thing I found was to right click, file path, and click the file I need. This worked up until the last step. Here's some screenshots:
-----------------------------------------------------------------------------
I need the "CoolCalc" folder, but when clicked nothing happens. Yes, I've tried restarting. I'm so lost on why nothing's working
1) If you want to just place images as is with no changing size, just move them into the drawable fodler. You can click Show in Explorer.
2) If you want your images to be used as icon of the app or tabs for example, then Android Studio can auto create different sizes for you. Right click on res, pick new and choose Image Asset, then pick image path and give it a name, you can apply some additional changes there.
3) For more sophisticated image addition you can add a plugin such as Android Drawable Importer
https://plugins.jetbrains.com/plugin/7658?pr=
UPD: "File path" just shows you where your folder/file is located. In your case your drawable folder as seen on your screenshot is located at C:\Users(your username not in English language, it seems, that's why it bugged)\AndroidStudioProjects\CoolCalc\app\src\main\res\drawable
If i understood right you have images on a folder and you want to put them in your app right?, Click in Show in Explorer this will open a the Drawable window then you can move the images
or you can move the folder to your assets

Android Studio automatic created Image Asset in folder midmap-xxxhdpi but name of icon appears in red (= error/not added?)

I just added my first icon for my app to my project. I did it by right clicking on the res folder and then selecting the option Image Asset which lets you create an icon on different resolutions and automatically adds them to the appropriate mipmap-folders.
Now I get the name of the image displayed in red in the folder midmap-xxxhdpi, maybe it's also useful to say that I got VCS running. I got no problems with all the other images in the different folders under res. What is causing the text to be displayed in red?
ps: also the ic_launcher-web.png is displayed in red.
"-" is not a valid resource name character
remove "-" from the pic name, and clean your project.

Trouble restoring accidentally moved Android drawable resource folder

I accidentally dragged the drawable-hdpi resource folder and moved it under the menu folder. This left me with an empty drawable-hdpi folder with a red x remaining in its place as seen in the screen shot
Performing an Undo Move gave me an error saying the folder already exists in its current location. I cannot drag it back under res as I get a similar error.
I was able to move the contents of the moved drawable folder to the one left in its original place, but the red x on it remains (after refreshing and restarting Eclipse)... which concerns me.
What does the red X mean? (note, this is different than the X you get when there are errors)
Anyone know what I can do to correctly restore the drawable folders?
The simplest thing you can do is.
Browse into the workspace folder to your workspace folder. I mean File Explorer not in Eclipse. Close eclipse by the way. For example, if the workspace is c:\workspace and the project is testproject, you should be browsing c:\workspace\testproject\res\menu\drawable-hdpi
Copy all the contents from here and go back to c:\workspace\testproject\res\drawable-hdpi and paste them here.
Do the same with the drawable-ldpi folder. Copy contents from the folder under menu and put it in the res\drawable-ldpi.
Manually delete the drawable folders from the ones in the menu folder.
Start eclipse. Select your Project and press the F5 or Right Click on the project and select Refresh.
If you are still left with errors, go to Project Menu - > Clean.
Let me know how things go.

Categories

Resources