Import image as a background in Android Studio - 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.

Related

Phone skin: round corners and a camera are small compared to the emulated phone screen, how to make them fit?

I downloaded skin of galaxy A52 from official samsung website: https://developer.samsung.com/galaxy-emulator-skin/galaxy-a.html.
Moved the file into the right directory, added the device: size 6.5 and resolution 1080x2400 and API is 31. I was following this tutorial: https://www.youtube.com/watch?v=6JIPsZpIJzE.
My question is: I have those corners and a camera too small, how do I resize them to fit naturally?
To change that you need to locate to the "Device frame skin definition" folder that you downloaded and pasted before. For me that was this folder:
C:\Program-Files\Android\Android Studio\plugins\android\resources\device-art-resources\Galaxy_A52
You should open "layout" file and see how different frames are set. In my situation I found that fore_port.png was at the forefront. I checked and it had dimensions 324x720. Dimensions of the screen are 1080x2400 so you should google "change dimensions of png" and change them. Then, replace the file. After this, restart android studio and everything works.
Now I have something that looks like this:

Why ic_launcher larger or not fit in my phone, but perfect in android studio?

I import an image assets from png. And android studio create all image for all size.
Looks like perfect in android studio. But when I install, the phone, zoom image or use wrong size. I don't understand.
Thanks any idea.
resize the image with photoshop or any image editing software and make the logo smaller. Maintain the image dimensions but make the contents smaller

How to make Android Studio create icons from SVG file

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].

How can I import a color image into Android Studio 3.6?

For some reason all images I import to my android studio project are gray scale. Previously I found a solution here:
The colored image turned to have no color and just a grey vector in drawable?
But apparently the batch drawable importer stopped working in Android Studio 3.6. Is there another solution I am unaware of?
Edit: Do I need to give more information or am I just the only one with this problem?
I did a lot more looking and if you click on "resource monitor" on the left (for me) there is a "plus" sign that you can select to add drawables. Depending on the file type, it will correctly import the drawable as a full color image

Help with application icons

I'm building a program in C++ (target is windows XP) using Visual Studio 2008 and I'm trying to add application icons, the ones that show up in the taskbar, explorer, desktop, etc. My .ico file has the sizes 48x48, 32x32, 24x24, and 16x16 pix in color depths 32-bit, 24-bit, 256 colors, and 16 colors. For what it's worth, I'm adding the .ico file to the binary in IcoFX.
I can get all the icons to show up like they should except for the one in the upper left corner of the program itself--the one that you can click on to bring up a menu with window size options--it still shows the default icon.
To get this little icon to change do I need a different image size or is there a completely different way of managing this one icon? Does that icon even have a specific name?
Thanks for your help.
Duplicated: How do I set the icon for my application in visual studio 2008?
According to one answer on that thread, you need to make sure that your icon is the first icon in the resources file.
Ok, I've figured it out:
I'm using wxWidgets as my GUI toolkit, so this is the only satisfactory answer I can give. wxWidgets has classes to set the main frame icons, those classes include wxIcon and wxIconBundle. Then wxTopLevelWindow::SetIcons can be used to set the application's icons. This sets ALL the icons (taskbar, main frame, alt-tab chooser, etc), no need to mess with a resource file in Visual Studio.

Resources