Background image size for tablets - android

I am creating an app with an full screen background image. I read a lot and made different images for different resolutions with the recommended pixel size and provide it in different drawable folders:
xxxhdpi: 1440x2560 px
xxhdpi: 1080x1920 px
xhdpi: 768*1280 px
hdpi: 480x800 px
mdpi: 320x480 px
ldpi: 240x320 px
I tested it on different phones and all look great.
Now my Problem: it doesnt't look great on tablets... and its logical. Samsung Galaxy tab 10 for example is 800*1280 mdpi.
So what is the solution? different folders for phones and tablets (7" and 10")? are there recommended sizes in pixels like there are for phones? how do others do this?
Thanks a lot for your advice!

If you are using drawables for background, and the image you added in the drawable surpass the dimensions from the list you supplied, it will be scaled by default (afaik).
Some things you have to keep in mind :
1) This applies both landscape and portrait.
2) If you are downloading the images from the web for creating the background drawable via code, you can handle the desired size by processing that image directly from the backend. Also, with libraries like Glide or Picasso, you can manage the resize thing.
Best regards,

Related

How to use the different densities (mdpi, hdpi, xhdpi, ...)

I see a lot of post on this topic, however I haven't seen an explanation on what image size to take as a reference, let me explain.
I want to add a background image and make it suitable for each phone screen size so from mdpi to xxhdpi (if I'm not talking nonsense)
What size should my base image be?
I used a 600x1200 image and a 1080x1920 then converts using this site
https://romannurik.github.io/AndroidAssetStudio/
Unfortunately I noticed that on my two phones the image was distorted, I'm starting to think my base image size was wrong
So my question
What image size should I take to then create multiple densities ?
Sorry if it's redundant !!!
I'm starting to learn how to adapt and it's not that easy
If you want to create a background picture, your reference size is mdpi with 320x480px. You can then calculate the size according to the factor
hdpi: 1.5 (480x720)
xhdpi: 2.0 (640x960)
xxhdpi: 3.0 (960x1440)
xxxhdpi: 4.0 (1280x1920)
Note however, that nowadays devices have all kinds of other aspect ratios (mostly longer). So you have to design your background in a way, that the outer area does not contain important content. Then use ScaleType CENTER_CROP and your image should not be distorted (https://developer.android.com/reference/android/widget/ImageView.ScaleType)
I think the site is for (mainly launcher) icons.
If your target device's display has 1080x1920 size with xxhdpi (3x) density, just put an image of the size in the res/drawables/xxhdpi folder. No other densities are needed to be prepared. They will be re-scaled from the xxhdpi image if needed.
If you still want to prepare for those densities, first prepare the highest density. If you want to use xxxhdpi (4x), you should start with xxxhdpi sized image. Then scale it down to xxhdpi (3x), xhdpi (2x), hdpi (1.5x) and mdpi (1x).
xxxhdpi (4x): 100%
xxhdpi (3x): 75%
xhdpi (2x): 50%
hdpi (1.5x): 37.5%
mdpi (1x): 25%
Support different pixel densities: Provide alternative bitmaps

minimum pixels of the largest image's side to fit android xxhdpi screen

I'm making an android App that shows images at full screen.
I learned some about dpi and dp, but I didn't find how many pixel must be the largest side of my images (in prospective to good fit also in landscape mode) to appear good in different devices.
As in the documentation, the most used screen configurations are normal with hdpi, xhdpi and xxhdpi density:
So, if my thinking is correct, I can make only one image to fit the xxhdpi to works fine also with the other two densities, and put it in Android Studio under the "res/drawable" folder (without qualifier).
Specifying the image size in dp in the layout, Android should scale the image for the smaller configurations.
But, for the xxhdpi, how many pixel must be the largest side of my image, in pixel, to show good?
Edit: how many pixel must be the longest side of my image to be showed properly in a device with xxhdpi density without the image appearing grainy?
All images are photo, not icons, so I can't use the vector graphics.
By looking at the Android Documentation. One can estimate the size of the picture. look at below picture
So, your image resolution should be in similar resolution
LDPI: 200 X 320px
MDPI: 320 X 480px
HDPI: 480 X 800px
XHDPI: 720 X 1280px
XXHDPI: 960 X 1600px
XXXHDPI: 1440 x 2560px
A little bit of +/- won't affect the outcome because with these standard sizes the aspect ratio of any portrait picture should be respected.
Well, if you put the image which fits the xxxhdpi inside the folder drawable, then it will fit all the screens.
But there is another way to use only one image instead of using multiple images for different resolutions. It's by using svg images which are vector images that will not be affected by zoom in or zoom out.
To use svg you need to follow these instructions:
Make the icon to be icon.svg
In the Android Studio, right click on drawable folder
Choose New -> Vector Asset
Choose Local File (SVG, PSD)
Choose your svg file
Click Next and choose the name
Click Finish
In the app build.gradle add the following inside android block:
vectorDrawables {
useSupportLibrary true
}
In the xml layout file, add the following:
<AppCompatImageView
android:width="wrap_content"
android:height="wrap_content"
app:srcCompat="#drawable/your_svg_file"
/>
Android have ratios defined for a image to set in all different drawables
Android icons require five separate sizes for different screen pixel densities. Icons for lower resolution are created automatically from the baseline.
mdpi: 160 dpi 1×
hdpi: 240 dpi 1.5×
xhdpi: 320 dpi 2×
xxhdpi: 480 dpi 3×
xxxhdpi:640 dpi 4×
Above size is for normal pixel icons. There are fix android size for Action bar, Dialog & Tab icons, Launcher icons & Notification icons
Check this link for more details http://iconhandbook.co.uk/reference/chart/android/
You have to take a look at the current market of smartphones.
Here you can see the screen sizes and resolutions of the most popular devices in the market.
http://screensiz.es/
Order the list in pixel per inch and you will see that top smartphones have resolutions bigger than 500 ppi or another way to see it, much bigger than 72ppi of your images.
If you have enough space to store or mechanism to download images try to test with full quality. If thats too much try to find a compromise. Lower image quality and see the result in high resolution screen.
Note that you didn't posted here the total size of image, in case is bigger than screen size, take a look at total size of image and compress it to fit your needs, maintaining as much as possible the resolution.
Edit: Looking only to size of image in pixels, the current biggest screen in smartphone is 2560 x 1440 pixels, so you wont need any image bigger than this.
If I understand your answer correctly, you are talking about images (pictures of lovely cats and dogs?) and not about icons?
I prefer putting images into the nodpi folder.
nodpi Resources for all densities. These are density-independent
resources. The system does not scale resources tagged with this
qualifier, regardless of the current screen's density.
Afterwards I would create a fullscreen ImageView and let imageView do the scaling if needed

android: Galaxy Note 2 : for which pixel layout images/icon should be prepared?

I am developing an app which must support Samsung Galaxy Note - 2.
Now note-2's pixel resolution is 1,280 x 720. Reference Wikipedia.
While developing an app, I found that it was picking images from res/drawable-hdpi.
So for what resolution layout I should prepare the images ? Or do need to make separate resource folder ?
Resources are picked based on DPI a quick reference for what DPI each device uses can be found here:
http://blog.blundell-apps.com/list-of-android-devices-with-pixel-density-buckets/
For image scaling, the images should roughly be sized like so:
if an image is to use 100 dp then the actual images sizes will be:
ldpi: 75px
mdpi: 100px
hdpi: 150px
xhdpi: 200px
if you want to use 100 px on your NOTE 2 then the image sizes will be
ldpi: 50px
mdpi: 66.67px
hdpi: 100px
xhdpi: 133.33px
you can use the following site do do quick calculations:
http://labs.skinkers.com/content/android_dp_px_calculator/
Prepare images for hdpi resolution -- 480x800 hdpi.
Galaxy Note 2 is normal size, xhdpi density and long. You can prepare layout or drawable for xhdpi. For details, please check this post Galaxy Note 2 screen specifications. If you don't have xhdpi resource, android will try to find resource in hdpi.
The Galaxy Note uses hdpi which is a pixel density of 240dpi
Android Device Resolutions

android, graphic design get blurred on tablets

In my application i'm using a background image with some text in it, it's size is 800x1280 (portrait mode)
When running the app on mobile devices , the background image looks great.
When running the app on tablet .. let's say Galaxy tab 10.1 you can see that the text in the background image is a little blurred and little pixeled..
it seems like if the image was smaller than the device resolution and got stretched.. only that image is already in the device resolution
What am i missing ?
Thanks
Your drawable folder contains folders ldpi, mdpi, hdpi, xhdpi - it's for different density per inch.
I suppose your mobile device uses mdpi or hdpi, while tablet uses xhdpi.
To get the best perfomance I recommend you to put 4 different sizes of your image to these folders. The sizes should be 0.75 x ORIGINAL_SIZE for ldpi, ORIGINAL_SIZE for mdpi, 1.5 x ORIGINAL_SIZE for hdpi, 2 x ORIGINAL_SIZE for xhdpi
update: tablets are hdpi, not xhdpi
Your device may be scaling the image somehow. Do you have your image in res/drawable? Try putting it in drawable-hdpi, drawable-mdpi and drawable-xhdpi also. This way it should pick the image fitting your resolution and refrain from scaling anything.
Note that you may want it to be scaled on other resolutions, so putting up different resolutions for different dpis is probably wise. But this is a good way to see if this is indeed the problem.
First of all, did you put your background image to specified drawable folders? :) Your image can be scaled.
If You're using linearlayout, you can check another solution, put imageview and layout into framelayout :)
Here you got examples:
android-scale-a-drawable-or-background-image
scale-background-image-in-linearlayout
:)

dpi of the image in the drawable folders

I'm currently designing images in four different dimensions (ldpi,mdpi,hdpi and xhdpi) for an Android application. i know that the different drawable folders are used dependig on the dpi of the devices' screen.
But what is the optimal dpi in photoshop to save the pngs?
Should images for ldpi saved with 120dpi, mdpi with 160dpi and so on?
Refer this,
http://developer.android.com/guide/practices/screens_support.html
According to that,
What I would do is design on a 300dpi cavas. That way there's no loss of quality.
// check this Link
You might be confused about what PPI (pixels per inch) to set your deliverables at. Just leave them at the standard 72 PPI, and scale the images accordingly.
Picture's resolution is not important for screen, it's important only for printing.

Categories

Resources