How to move all the density versions of resource in one command? - android

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.

Related

How to see a preview of custom vector asset (added by SVG format) in Android Studio?

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.

Why does my launcher icon look different?

See the image:
Why does my icon look different to the other icons on the screen? In Android Studio, I set trim to zero and yet it still shows up like this on my phone. I have Nova Launcher installed which makes all my apps have rounded icons, but look at the Google Maps, and Instagram, how do I get my icon to fill the circle?
WONDERING WHY IT DOES THIS REQUIRES VERY SIMPLE EXPLANATION:
in new boiler plate code that comes on android studio project generation it makes some extra files in the mip map ! as for the big api based phones have a nature to put a round bracket icon behind every launcher icon of the apps! So All you need to do is very simple if you want to override that! follow the image based foot steps shown below
HERE IS HOW YOU CAN ADD A CUSTOM ICON WITHOUT ANY ROUND whit icon behind it!
STEP ONE! .
go on your any res folder drawable or mipmap and right click and reach to the option shown in the image:
STEP TWO! .
After clicking on your image asset it will ask to make icons for both old and new phones! but we don't have to select that! ok? see the image for it!
STEP THREE! .
CLICK THE ICON TYPE SPINNER(DROP DOWN) and select mipmap legacy only like shown here
STEP FOUR! .
CUSTOMISE YOUR PICTURE LIKE shown here! by back ground etc how ever you like!
STEP FIVE! .
You will see images being saved only in mipmap folder not in the ic_launcher round folder
STEP SIX! .
You can see the image you created as icon in ic_launcher folder
but
STEP SEVEN! .
THERE IS a GOTCHA STILL SOME IC_LAUNCHER BUILTIN TEMPLATE PROVIDED files are there you have to delete that folder as shown
:It will cause the alert that how we are supposed not to do that but its ok! just follow the step 8 and you will have the icon of your choice no matter what phone you are testing your app on!
STEP EIGHT! .
GO TO YOUR MANIFEST FILE AND DELETE THE HIGHLIGHTED line and you are all set! ^_^
With the release of Android Oreo the launcher icons changed a lot.
But with Image Asset Studio (integrated in Android Studio) we can easily generate everything we need (26+ and 25- APIs). Here is explained how these new adaptive icons work.
In this article you can read everything you need to know step by step, but in summary: you need two icons (square and rounded) for 25- APIs, and two layers (background and icon image) for 26+ APIs. Android Studio will generate everything you need if you can provide those elements.

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.

Categories

Resources