How to make Android Studio create icons from SVG file - android-studio

I am relatively new to Android Studio and am having trouble getting the launch icon working properly.
Initially my icon file is an SVG called icon.svg. Using [File > New > Vector Asset] adds the icons without error and I can see all the mipmap ic_launcher files and they appear to be PNG files. However when I build, upload and install the apk to Android I get the green hatch background with no icon.
Next I try converting the SVG to a PNG in my assets folder. This time [File > New > Image Asset] adds the icons without error and I can see all the mipmap ic_launcher files again, they appear to be PNG files. This time when I build, upload and install the apk to Android I get the icon but the green hatch background is showing behind it.
All my source images for my app are SVGs. Ideally what I would like to be able to do is generate all the Android icons from my icon.svg file and have them display without the green hatch background.
Here are some screen shots to show what I am seeing in Android Studio.

That green hatch background is the file you have in the drawable folder named ic_launcher_background.xml, this file is added as default background if you don't modify the tab Background Layer when you are in Configure Image Asset [File>New>Image Asset].

Related

Android Studio - no image and button color showing in both design and when I run it on my device

there is no image and button color showing in both design and when I run it on my device.
There are no problems with my other images which was in .jpg and .png format. Those images that aren't showing are the background for my button and is also in .png. The same problem with the color of my button, it isn't showing also.
I tried transferring those background images for my button images to 'mipmap-xxxhdpi' but still no changes.
can you explain in more details what are you trying to do,
If that helps try add the image to the drawable folder
and add this line to your button in the XML file
android:background="#drawable/image_name_here"
also the name has to be all in lowercase and with not " _ " characters

Unable to create notification icon on Android Studio using custom image

I am trying to create notification icon using custom png image on Android studio. In Configure Image Asset Screen, when I select my custom image, all it is showing 5 black boxes with white circles in it. Can any one please let me know why it is not selecting custom image.
Below is screenshot of Android Studio
Below is custom image with which I am trying to create notification icon
Can any one please let me know why it is not selecting custom image.
The icon should contain one color (second color should not be present. It should be transparent). My Icon contains red and white both. That is the reason Android studio is not able to identify the image and displaying the whole image as white circle. I asked design team to create an image which has only one color and remaining area as transparent. I created notification icons using that image given by design team.

Android-Studio implement Background

I have just started programming with Android Studio and I don't know how to put a background image on the design.
First, you need to import a .jpg or .png by dragging it into your drawable folder. Then create an ImageView by dragging from your toolbox onto the design view of your activity. Finally, on the the Background property of your ImageView, click the square to the right of its text area. It will pull up a wizard where you find all your imported drawables.

Import image as a background in Android Studio

How should I import .png image that suppose to be the background of my activity? I selected drawable folder from the project panel then opened the New menu: 'Image Asset' , but this option is for importing icons so I guess it's not right decision (I need to import an image to be spread over all the screen background). I then chosed instead the option 'scaled drawble' (maybe it's not part of the default Android Studio installation but provided as part of some plugin I installed)
This option actually imported the .png to be under my project in different scales (mdpi, hdpi etc.) but is it the the most recommended option in order to add background images to Android Studio? Because I noticed that the xhdpi and xxhdpi became in bigger KB size than the original size of the file that was imported (doesn't make sense that its size is bigger than the source)
Right-click the drawable folder, and optimize imports, then it shows the path of drawable folder, open this path in Windows Explorer, copy any image to the path
I am using that plug-in too. but problem is plugin uses original image as xhdpi and scales others. this means if your image is very big for instance ldpi will be very big too and file sizes will be too large. I am trying to find standard image sizes.
I think using a big image that is big enough for xxxhdpi and paste it in drawable-xxxhdpi or drawable folder is safe way.
if your image is good to scale(I mean something like .svg images) or just don't care about scaling paste it in xhdpi and system will scale it.

android studio : dpi folders not showing in my project

in my project, the images folder is displayed according to the image name instead of
drawable
drawbale-hdpi
drawbale-mdpi
drawbale-xdpi
drawbale-xxdpi
I see the folders in most of the tutorial when they create a new project,
and I just follow to start my new project without any setting be changed.
Do I have to change some setting?
From your first screenshot, it seems you're in the Android view of your Project tab. Click the top left drop down (again from the first screenshot), and change it to Project. Then if you would navigate to your res/ folder you would see all of the DPIs first instead.
Additionally, you could also expand the icon1.png in that current Android view as it is a folder. Therein you would find all of your icons matching that name in every DPI you had them available.
Android View's res/ sorts by drawable name.
Project View's res/ sorts by DPI.

Resources