Android Studio Drawables - android

I want to make all drawables files from one image.png
I tried Image asset from android studio but it creates too small images..
Anyone got an idea how can i generate from one png file all drawables files?

Not sure if this is what you're looking for. But with this tool you can generate images of multiple sizes:
Android Assets Studio
You can upload images, and get icons back, in the sizes of xxxhdpi, xxhdpi, xhdpi, hdpi, mdpi

Related

Folders for different screen densities for Android

There are multiple groups of screen densities of Android phones (ldpi, mdpi, hdpi and so on).
I had a folder "drawable" with picture size 1920 x 930 pixels which is for xxxhdpi, I guess.
I want to arrange pictures for all screen densities from xxxhdpi to hdpi. So, I should rename my existing folder: "drawable" -> "drawable-xxxhdpi". Then, I should create 3 additional folders for others. Do I understand it right?
How would actually the program choose proper folder?
For example, I also have smaller pictures now. Should I also resize them? If I don't duplicate them in new folder, will the program crash?
Will the program crash on phones with, for example, hdpi if I don't create a folder for hdpi?
Couldn't get how it works, would be grateful for an explanation.
First of all be sure that you are in the "Project" view because you will not see all the folders if you are in "Android" view. Then instead of renaming drawable folder create the others and keep drawable for some files that doesn't need to resize (for example defining a background). Folders should be:
drawable-hdpi
drawable-mdpi
drawable-xhdpi
drawable-xxhdpi
drawable-xxxhdpi
Selection between them will be done automatically according to the screen of the device you are installing the app. If screen is xxxhdpi and you don't have a file for that resolution the app will take the smaller and so on. Obviously this will not be a great UI performance but you should not have problems with crashes.
There are many online App icons generators in the web so you can take a big icon and put it there so you get the icons for all sizes

Image with different dimensions?

android studio 3.6
In android app I use one image with different dimensions. I put image in the next folders:
drawable-hdpi, drawable-mdpi, drawable-xhdpi, drawable-xxhdpi, drawable-xxxhdpi
Nice. It's work fine.
Now what about flutter app. Is I also need to create different folders for every image's dimension?
P.S. I need this image for android and iOS version
As mentioned in the Declaring resolution-aware image assets. You can create folders based on the resolution and add images to it.
The main asset is assumed to correspond to a resolution of 1.0. For
example, consider the following asset layout for an image named
my_icon.png:
.../my_icon.png
.../2.0x/my_icon.png
.../3.0x/my_icon.png
On devices with a device pixel ratio of 1.8, the asset
.../2.0x/my_icon.png would be chosen. For a device pixel ratio of 2.7,
the asset .../3.0x/my_icon.png would be chosen.
Reference Assets and Images
For an Android App created using Flutter, You can still use these folders as shown below for varying screen densities

Converting SVG into Raster PNGs by Android Studio

I am working with Android Studio 2.2.2. I am developing a project and it will be used in Tab 7 inch.
I am importing SVG through vector asset wizard. My tablet, where I am compiling the APK is 7-inch. After installation, the application showing the SVGs in very bad quality.
I made several types of research and concluded that my Tablet is having API-19 and android studio is converting all SVGs into the Raster PNGs (For all devices below V-21) at compile time and place them on the following path
D:....\app\build\generated\res\pngs\debug
When I looked at this folder I found
I know for 7-inch Tablet drawable-large-mdpi or drawable-large-hdpi is required, because android studio is not creating the drawable folder for larger screens and placing the Raster PNGs into smal screens drawable folder, That's may be the reason of bad quality of SVGs because 7-inch tablet is using the PNG from drawable-mdpi which is made for small screens.
Can anyone advice how to force Android-Studio to create drawable-large-mdpi folder under app\build\generated\res\pngs\debug and place the converted Raster PNG into it.

Using hdpi drawables in mdpi tablets without creating image copies

I want my app to be as lightweight as possible. So i put all my images inside drawable-xxhdpi and let the Android OS to resize them.
However for the 10 inch mdpi tablets i want to use hdpi images. I know, that it is possible to create drawable-sw720dp-mdpi and put there hdpi images. But this will increase apk size, which is not the option. So, is it possible to make such a change without making drawable copies?
create a drawable folder in res folder of project and paste all images there...it will resize all images according to device size
Let's say you have a set of resources called icon_text.png; and you place one in the drawable-xxhdpi folder and another one in drawable-hdpi folder. That is your scenario, right? Any device that is mdpi (it doesn't matter its size) will pull resources (if available) from the hdpi folder. The system will pick the closest match, and mdpi is closer to hdpi than to xxhdpi.

Android app download pattern involving same image on different devices/screens

Let us suppose that I made an android app that has an image in it.
I had kept the same image of different sizes in xxxhdpi, xxhdpi, xhdpi, hdpi, mdpi and ldpi Drawable folders.
When a 'hdpi android phone' downloads my app, will it it download the image from all the Drawable folders or just the 'hdpi' Drawable folder ?
I wanted to know if using separate images for separate screen types increases the app size or not.
Yes the download of the APK always includes all resources you have included.
Your apk will be downloaded with all the internal resources(Images,raw directory etc..) and your APK should not be above 50MB if your APK size exceeds this limit you may have to use seperate Expansion files. Description Here
EDIT:
You can try Multiple APK Support if your apk size exceeds 50Mb limit and you still want to embed all resources inside your APK Described Here

Categories

Resources