Android Studio image resolution - android

I have an image with resolution 300x450. I want to use it on an Android Studio app.
When I create a new "Image Asset", the pic looses its resolution, and if I select manually the resolution at the ImageView, it pixels.
What can I try?
Thank you

Fixed. The problem is, that you mustnĀ“t to insert it as "Image Asset", you just have to drag the pic, to the Drawable/xhdpi folder. Then, you can to use it, with no problems.

The image size you are using should have the resolution for the highest density (xxxhdpi) beacause when you create a new Image Asset, Android Studio create N different drawables for that image, one for each density, using the one you have as the "xxxhdpi one".
For example, let's say that image 300x450 is for a xhdpi screen. When you use that tool to create Image Asset, Android Studio will create a xxxhdpi asset 300x450, a xxhdpi 225x337, a xhdpi 150x225, and so on... And you try to use that xhdpi 150x225, in the same place you should use 300x450, and it pixels.
So, my solution, if you don't have the highest to generate the other ones, you should put that one directly in "xhdpi" (or the one it is designed for), and you can be sure that at least all density or lower than that, will be OK.

Just use scalable option in properties menu. in that select fitXY option and adjust your coordinates with height and width properties

Related

How to import high resolution image to android studio?

So whenever I import an image as an image asset it is always blurry. When asked what type of asset is it I always select launcher. (Because thats the only way.)
I'm using the drawable as part of a selector, one image when pressed and another when not. Is there another way I can put an image in android studio?
Use Draw 9-patch tool to create bitmap images that automatically resize to accommodate the contents of the view and the size of the screen.
You can get this tool from your Android SDK sdk/tools directory
http://developer.android.com/tools/help/draw9patch.html
Note : I You want to put image according to device resolution add your image to these folders hdpi, xhdpi ,xxhdpi
You can put images in Mipmap of all the resolution in different folder like hdpi, xhdpi ,xxhdpi and you can use it

Android Appropriate Image Resolution for ImageView

What is the proper/right resolution for Image to be put using src in ImageView to avoid stretching or unscaled images?
if you are using a single color of background, u can use 9Patch images. but if you are asking about icons then you need different images for different resolutions in drawable folders like drawable-hdpi for hdpi devices drawable-xxhdpi for xxhdpi devices.
for more detailshttp://developer.android.com/training/basics/supporting-devices/screens.html
To understand the image size check out the following link image size (drawable-hdpi/ldpi/mdpi/xhdpi) . To avoid stretching use "android:scaleType="fitcenter/fitxy/centercrop"" for more detail check this http://developer.android.com/reference/android/widget/ImageView.ScaleType.html
Actually it totally depends on your placeholder or your needs, rather than single image you can make different sizes of image for different dp like small,large,normal,x-large .
probably https://romannurik.github.io/AndroidAssetStudio will save your time or new Android studio 2's built in plugin.
More resource
http://developer.android.com/training/basics/supporting-devices/screens.html

How to select source density of image when using android ui utils

I am generating nine patch images using android ui utils
I am not sure of what to select for the source density field.
How do i know the right density to choose?
Is there a way to determine this from my image dimensions?
Thanks
It's source density, like if designer draw for mdpi (for example, screen resolution is 320x480), and give you images in this density, you need choose mdpi.
Also i recommend you this nine patch editor.

Android development - Drawable images resolution, how to export?

So, I am just a beginner and I already went trough android documentations about supporting different screen sizes and I understand most of it.
For my app, I created different layouts for each screen sizes and on the emulator it looks good.
Just one question.
How should I export images to my drawable hdpi.lpdi,...mdpi...folders?
Because, What I did was, I used art text2, and created a project with 700x700. Well. I set it to transperant, so it's not excatly 700x700px. cause the image does not fill the entire space.
So, before I hit export, should I change the PX Resolution for example for 450x450 or something for mdpi? But, I didn't do that, and I amnot sure if I should have done that. then i hit export and it asks me where i want it to save the image. It also gives the me option to the change the DPI Resolution in DPI, i changed to 160 and saved that in my drawable/mdpi folder. But I did not change PIXEL resoultion.
So, was it correnct? or should I have changed the pixel resoultion before, I export the actual image?
In Eclipse, However, I change the width and height of the image in dp not px. so it doesn't take the entire screen space.
I checked my app on different screen sizes in Eclipse and it looks awesome. But, in the emulator, it looks cool. HOWEVER, if open my hdpi emulator the image does not look very sharp or clear. What's the problem?
The image itself looks clear and sharp if open it with my image viewer on my computer even, the image viewer window is almost taking the entire screen of my laptop (14,1280*800).
I will suggeset you to use 9patch image. you can create 9patch image using android tool called draw9patch Located in sdk/tools.What you have to, create a high resolution image and then give to draw9patch tool it create image with extension .9.png and use that image
See the link for detail
http://developer.android.com/tools/help/draw9patch.html
Okay if i understood right, then you need to have 4 res for each image, and the aspect ratio will be "1:1.5:2:3" and some times "1:1.5:2:3:4" so you have to get all the images that you need in 3 or 4 sizes and let the android os properties do its magic by choosing the right picture based on the screen size.

in which folder put image for setting to background of layout android

i am putting the image in three of the drawable,drawable-hdpi and drawable-ldpi for supporting all type of screen but when i see the output of background image in 240*320 screen resolution the background image is not as clear as origional so my question is where to, means in which folder i put the background image for supporting it all type of screen size and density, maens then my image should not distorted or bluer...
i am using the background image of size:320*480
thanks
make one folder name
drawable-nodpi
put your image in that and use it and dont keep that image in other folders.
the image will not be scaled or stretched.
Anoher Way
the best way is to make 3 different size images and put int drawable-ldpi(240X320),drawable-mdpi(320X480),drawable-hdpi(480X800) folder with the same name.
TO LEARN MORE PLEASE VISIT THIS LINK.
Supporting Multiple SCreens
You can put different same image in drawable-hdpi,mdpi and ldpi.Depending on the density of devices they will take the images from the corresponding folder.
With different devices you should have same image but with different size and density.for You can search in internet the specifications of devices.If density is less than 160 then put image in ldpi,if 160 then use mdpi and if 240 or above use hdpi.Also change the size of image to the screen size of corresponding device.Hope it will help.

Categories

Resources