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
Related
I know i can use my own svg as icons by browsing them from the asset studio but it just show the name not the exact icon of the svg, i can't know just by name what that icon is look like , so can i view them while adding them to project like they are showing in below image?
I have many icon on my computer can i add them to that list , so that i can see them visually when i want to add a new vector asset.
I tend to think that it can be done because then icons which android asset studio is shows must be stored in a directory from where it pulls when when i open asset stdio , if i can add my svg to that directory then android studio may may also pull them too with default clip arts and they may also show up in asset studio, does anyone know what that directory is , or any other way of doing this.
Note android studio does not give such option via UI
When you add a new vector asset (assuming you've added it in the drawable directory), it gets added in the drawable directory.
It is generally saved by the name ic_thatSVGname. So it gets the prefix IC. So please browse in the drawable directory and you will find your vector asset.
Then double click on it so that it opens and you can see the preview on right side of the screen. It it doesn't, just click the PREVIEW button which also reside on the right side of the Android Studio.
So that means just search for that in drawable directory. And while adding new vector assets, right click on the DRAWABLE DIRECTORY only so that it gets into that directory else it might end up outside it.
I've got many image resources in several densities, and I'd like to move them into an other module. Moving them one by one takes a long time, especially because Android Studio's Project window goes into some kind of flickering on every file move.
For exemple, I'd like to move the following resources:
module1/src/main/res/drawable-hdpi/image_a.png
module1/src/main/res/drawable-mdpi/image_a.png
module1/src/main/res/drawable-xdpi/image_a.png
module1/src/main/res/drawable-xxhdpi/image_a.png
into
module2/src/main/res/drawable-hdpi/image_a.png
module2/src/main/res/drawable-mdpi/image_a.png
module2/src/main/res/drawable-xdpi/image_a.png
module2/src/main/res/drawable-xxhdpi/image_a.png
Is it possible to move the four files in one go, instead of having to do a Move... on each file ?
I propose this solution.
In module2 project, right click the res folde, then select the New > Image Asset menu.
Then, in the Configure Image Asset window, select the right Icon Type and , in the source asset section, select Image as Asset Type and enter the path to the xxhdpi version of the image from module1. You may need to pay attention to the other fields before clicking the Next button.
This will automatically generate all the image resources.
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.
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.
My ImageButton in my app is very tiny and cut off. I realized this could be because the image was in the drawable folder instead of the mitmap folders. So, I copied the images from the drawable folder, and pasted them in mitmap folders. Now, should I go about deleting the image from the drawable folder? I get the following saying it is not safe:
I know how to access the images, but should I delete them from the drawable folder now that I have already moved them to the mitmaps? If I do a delete anyway, will I need to alter my code to access the mitmap image? What is safest to do?
Here is an image of my mitmaps:
Thanks for the expert advice,
Rich
"Not safe" in this context just means that it's still being used somewhere. If you delete it, the current usage will fail to compile, and you'll be easily able to find and alter it to point at the new location.
You can safely delete this image, in Android Studio if you are using this image or else the file will be open at some place, you can get this error actually, so try deleting this image will safely remove the only selected image into your workspace. So hassle free to delete it.
After deleting your image, clear your project and run it, it works fine.
The mipmap folder is used for image that are very small and should be used in the action bar, and other menus. If you find your image too tiny, it just will be worst if you put it in the mipmap folder. If it's tiny although the image is in the drawable folder, maybe the image has a very small dimension or your imageview is too small.