Android screen resolution and pixel ratio - android

Hienter image description here
Can someone maybe explain me how the screen resolution on a android device is working. On this device i can change the screen from normal to small. The resolution is the same, but the device pixel ratio is different. What is happen with the screen. The reason for my question is that we have some designers that ask for the resolution. But it seems to be the same, but yes the content is smaller, so i don't know what the resolution will be?
Thanks :-)
enter image description here

You can create multiple XML for the single screen which targets the device sizes. check the official document for qualifier.
https://developer.android.com/guide/topics/resources/providing-resources
OR
Simply use this library It's awesome -
https://github.com/intuit/sdp

Related

Optimum Unity Android splash image resolution

I've Unity Plus and I'm trying to find out the optimum android splash screen size that fits all android devices as there's no option to specify multiple images with different resolutions for android.
So far I've tried 768x1024, 1536x2048 on every option(center, fill, fit), however some nexus tablets/phones won't display the splash image full screen correctly.
Is there an optimum/suggested image resolution/configuration for android devices that most likely fit all?
There is a Splash Scaling property in Player Settings for Android builds. Try setting it to Scale to fill (cropped). Your splash image will be scaled without changing the aspect ratio.
We are using 1280x720 image in Unity 5.3.4 for android builds without any problem.
The image will be cropped but if there is not any sensitive text or symbol on the edges that will not be a problem.
Hope this helps.
Generally, you'll want to include multiple copies of the image at different resolutions and aspect ratios in your deployment. For example, small and large, both with different ARs. You would read the screensize of the device and select the appropriate size image for the device.
To give more detail here, I worked on a game that targeted devices from small screen sizes (Galaxy Ace), to large tablets (Galaxy Note 10.1). We used our own splash screen implementation rather than unity's, and we calculated the aspect ratio of the device. We then checked the screen resolution. After that, we had enough info to select the appropriate resolution image for the screen. It costs a bit more space, but it looks nice and crisp on almost every device.

app crashes when opening multiple image

I am making an app for story books, i have my curlview animation for this app.
My problem is that i dont know what size of image and what resolution should i use for 3.5 inches to 5.0 inches screen.
I always reading on supporting multiple screen size but the problem is that i cannot get that.
All i want is the exact image size in pixel and what is the resolution should i use.
i always use 72 as resolution but i dont know what is the dimension should i use for 3.5 to 5.0 inches screen size.
did anyone knows what should i use? i dont want to read supporting multiple screen size because i already read it and i did not get it.
Thank you to someone who can give me the size i should use that will not get crash in my app.
Thanks again!
As it said in the Android style guide icon size scale for different screens should follow the 2:3:4:6 scaling ratio. Maybe you can use this ratio for other, not only icon, images too.
As you write you read the documentation, I assume you already read the Android Best Practices Chapter about Density Independence. If I got your question right, you're looking for the following part of it:
The system scales dp units as appropriate for the current screen density.
The system scales drawable resources to the appropriate size, based on the current screen density, if necessary
[...]
By default, Android scales your bitmap drawables (.png, .jpg, and .gif files) [...] so that they render at the appropriate physical size on each device.
So you basically need to provide an screen-size independent layout, and Android takes care of the rest. However it is encouraged to deliver multiple images for a better scaling quality.
If you can only afford a single size for the images, I'd decide on a target audience (e.g. how likely are Tablet users, what is the average device's screen size in my audience -> how many pixels will be available in the area you want to display the image) and then calculate the resolution of the images based on that. If a user needs a smaller or larger version, Android will scale the image up or down, given your layout is correct.
From what you write, it seems to me like you're targeting normal screen sizes, so you can have something between 470dp x 320dp and 640dp x 480dp. To get regular pixels, you must think about the screen density of your users, refer to a Question about dp/px conversion for details.

Creating base PSD to design Android App UI for mdpi, 320/480px device

I'm starting my first Android Phone design work. I have some experience with iPhone, iPad design but Android is totally different, I'm even not sure how I should create my base template.
Here is the device info I'm going to design. the app that will work only on this device, no need to multiple screen compatibility thing.
mdpi
256K color
3.5"
~165ppi pixel density
320px/480px
So, do I create my photoshop file for 320px/480px, 72px resolution, rgb?
Appreciate helps!!!
Google has made a whole site dedicated for your needs:
http://developer.android.com/design/index.html
In your case, your PSD settings should be setup like this:
NOTE/EDIT: Notice DPI is set at the default of 72. This is because DPI is meta data for printers. When you read DPI in phone specs, they are talking about the physical representation of how far apart the LCD is packed together. Resolution of the image (320x640) is the only thing you need to care about.
Have you looked at the Android Design site? It's specifically designed for... well designers.
Look at the devices display section and also the supporting multiple screens page to get an idea of what the general categories of screen sizes are and what an acceptable size and range for these is.
Android in general uses DIP's (Display independant pixel) so the actual pixels per inch depend on the screen you are creating art work for. You have to design for xlarge, large, medium and small screens with differed densities. General advice is to start with medium density screens and then you can increase density and decrease it in your artwork as needed. The link above gives the general dp dimensions of each screen size and density ranges of different types of screens. There should also be some info about converting dp to pixels.
While google frowns on what you are asking (designing for 1 device in particular), you said the device as 166ppi so you could just use 165 pixel / inch in your setting and set the height and width of the PSD depending on the size of your screen (whatever it's width and height is in inches).
This Smashing Magazine article on designing for android should really help. It's old but relevant.
Android is very different. If you learn how to do use the properties offered by android the right way it works greats.
Quote from developer.android.com
Each screen size offers different possibilities and challenges for user interaction, so in order to truly satisfy and impress your users, your application must go beyond merely supporting multiple screens: it must optimize the user experience for each screen configuration.
There are some tools you should get to know as well such as 'draw9patch'
The best thing to go off of is to simply create a layout in Photoshop just to get the layout down. It will not really matter what exact size as long as you have a rectangular shape. Make your layout and then start to make it fit in android.
Many great tutorials online, but as I mentioned before. Create your layout, then start to customize it for android by using tools such as draw9patch
Because you said your screen was ~165ppi, ppi = pixel per inch. Also, the Android docs describe 160dp as the generally accepted size for MDPI. – Ali Feb 7 at 22:22
so why in google samples
( ex : IDEName\AndroidSDK\samples\android-8\NotePad\res\drawable-hdpi ) ,
if open image ( ex : app_notes.png ) in photoshop and press ctrl + alt + i , to see resolution , its 72dpi !
but Ali says MDPI = 160dpi , HDPI = 240 , ...
so its must be 240dpi , not 72dpi.
The bitmap requirement is similar to preparing graphics for print vs. the Web. If you have any experience with print production, you’ll know that a 72 PPI image will look very pixelated and blurry when scaled up and printed. Instead, you would need to redo the image as a vector image or use a high-resolution photo and then set the file’s resolution at around 300 PPI in order to print it without any loss of image quality. Screen density for Android works similar, except that we’re not changing the file’s resolution, only the image’s size (i.e. standard 72 PPI is fine).
Android Smartphones And Display Sizes

Android image sizes

Im getting started with android development and i have a few questions about supporting different screen sizes. I have read all about it here but still dont get how to use different sized images for different screens. My situation is that I have put an image in res/drawable/hdpi which will be picked up when running on my samsung infuse 4g as well as on my galaxy 10.1 tablet. Because they have the same density class the image will have roughly the same physical size on both devices. And this is the problem, obviously I want the image to be way bigger on my tablet but I have yet not found a way to do this.
I did look at another classification whith small, medium and large but that seemed only to be applicable to layouts and not image resources.
Any pointers would be appreciated.
Thanks!
Those two devices don't have the same density. The Samsung Infuse is hdpi, the Galaxy Tab 10.1 is mdpi.
Further, you don't generally want the image to be bigger on the tablet. Consider -- if I have a list of contacts in my application, I want them to be the same height on the phone vs. the tablet because there is no use making them taller (that height is sufficient to display the text and be able to tap on it with my finger), but rather that I want to do is use the extra space to be able to display more of them.
If you really do want an image that is larger on the tablet than on the phone, you are going to need to explain more about what you are actually trying to accomplish. For example, maybe this is a background image? In that case maybe what you are looking for is to just have the image stretch to fill the screen. (And be aware that doing background images on Android is tricky because you do need to deal with a wide variety of screen sizes you will be fitting. To avoid making yourself go insane, background images should generally be very abstract so that stretching works well on them. Look at the background images used in Android 3.0 and 4.0 for the default themes as an example.)
If you are writing a game, this is a very different world, and you should consider whether you want to use density based resources at all. Generally games will have resources that are independent of density, and just have their game playfield fill the screen and are happy with the result being something larger on a tablet.
After putting images into for example
/res/layout-480x800` - if you know resolution
/res/layout-w480dp - if you know witdh
/res/layout-h800dp - if you know height
Android automaticly choose picture for you. Just put picture in resolutions but with the same name into this subfolders. Then just use (without spacyfing qualifiers):
android:src="#drawable/background"
or
imageView.setImageResource(R.drawable.background);
The order of precedence of qualifiers can be found in documentation (Table 2)
Tablets are usually xhdpi, not hdpi. So, for your Samsung Infuse, place the image in:
/res/drawable-hdpi/
And for the tablet, place it into:
/res/drawable-xhdpi
When setting the image resource via
android:src="#drawable/image"
or
imageView.setImageResource(R.drawable.image);
It will pick the appropriate image based on the density of the device.

How to choose correct image resolution for android

I have been battling with this for a couple of days. I am trying to write a small custom rating bar. With some custom images. When I check the image I have on my HTC Desire, the image looks horribly aliased. I have tried using different resolutions and different sizes and still can't figure out what resolution/how to create a good quality.
I have read the guidelines on the android site but, to no avail. I think the problem I am having is displaying lower resolution images on a higher dpi display. So the system upscales the image. But I am not sure how to fix that. Higher resolution images? Larger images?
Any advice would be great.
Alex
The reason why this is a bit of a challenge to get right is the wide variety of screen-resolutions and -densities of Android devices. Fortunately the Android SDK has pretty extensive support in this department. A very good start is this section of the Android Dev Guide.
Basically you need to understand the concept of Density-independent pixels (dp) and use classes like DisplayMetrics to calculate actual screen pixels. And yes, obviously you'll need larger, higher resolution images for higher density screens.

Categories

Resources