My application is supporting 3 type of density ldpi (120),mdpi(160),hdpi(320) and for that we have three folder for resources (ldpi,mdpi,hdpi).
But my problem is occurring in HTC sensation XE (540x960) having density ~256 dpi.and my resources is stretched.
In manifest file
<supports-screens android:xlargeScreens="false" />
means i am not supporting for xlarge screen so does 540x960 come in high density??.
How can i overcome this problem???
Android Multiscreen Support issue says "You can also use a combination of density and size qualifiers but that still leaves some room for two different resolutions falling into the same bucket."
What should be the name of drawble folder for this kind of resolution??
or is there any other way to short out this issue.
EDIT : My problem is not with layout, my problem 540x960 come in HDPI but my hdpi drawbles are designed related to 480x800
Help me..
Thanks in advance..
you can use below combination for Layout for HTC sensation XE (540x960) :
res/layout-w540dp-h960dp/layout.xml
this will use for pick layout for this device and for drawable it will pick image from hdpi because in this developer site 256 dp come in range of hdpi . http://developer.android.com/guide/practices/screens_support.html.
hope this will help you.
Your problem is that you have designed your bitmaps for a particular screen size rather than screen density.
Plainly put, you should not do that. There are a huge number of different form factors and screen sizes out there, and you cannot hope to have graphics sized for all of them. So you fix this issue for 540x960 screens... what then with your users who are on 480x854 displays (most hdpi motorola devices)? Will you include different graphics for 1024x720 and 1280x720 displays if you're developing for that? What about 1280x800?
Granted - it can be a pain to deal with these issues, but that is the price we pay for diversity of devices. And Google has provided a fair amount of powerful tools at our disposal to deal with this.
When you are designing an app for Android, you need to think of the design as if you were designing a website - not a desktop (or IOS) program. All (or most) of the tricks that you use for designing a website also apply here - plus you have the density-awareness and 9.patch tools.
And if you really cannot adjust your graphics/layout to the screen without messing it up, you can always center the layout on the display (or align it left or right, depending on what you think looks best).
Edit:
As I mention above, the core to flexible UI design in Android is to think of your app like a web site. Roman Nurik has an article discussing this on the Android blog.
http://android-developers.blogspot.com/2011/09/thinking-like-web-designer.html
Apart from that, it is mostly covered by the Android site, etc.
http://developer.android.com/training/multiscreen/index.html
Using the right layouts and 9-patch images (not always - sometimes static images are better) will allow you to create designs that look good on all phones. But you have to realize that - like a website designed in a browser - you do not and can not have 100% control over how things are displayed on every single device. What you need to achieve is that it is still accessible and good-looking even when displayed on a device that you did not anticipate beforehand.
You have to name the drawable as per your pixel density and the screen size. The calculation is here...
dpi = sqrt (540^2+960^2) / 4.3"(Device size) = ~256 dp = px / (dpi / 160) = 540 / (dpi / 160) = 330
The drawable will be named as drawable-sw330dp. I have tested this. And this works good. No problem with other drawables either. Layout Will be layout-sw330dp
Or you can try this by drawable-sw540p. I haven't tested it yet. But I guess it will work good. Layout Will be layout-sw540p
Related
I'm required to design an apps for android.
And after some reading, I find out android device are divided into few categories in term of resolution, like
small screen
normal screen
large screen
extra large screen
but in different density.
So lets say, now I need to come out a design for normal screen, what resolution that I should use for the "look & feel" of the apps UI.
From the reading, I know android apps are use dp instead of px. So, is it means I have to convert few specific screen size to dp before I start to design ?
Or I just simply target a common resolution for normal screen size like 320x480, provided I will have few set drawable in different density ?
Please correct me if I had mistaken it.
Thank you
Good question, so far we have 5 screen densities :
xxhdpi,xhdpi,hdpi,mdpi,ldpi , now if you have an image resource you will need to create 5 copies of it, its always recommended to start by the xxhdpi till you reach to the smallest,
however you can use online calculators that will calculate the PX and DP for all the densities, i recommend these two tools android developer toolbox and developers tools, and with developers tools you can test the colors, and how are they going to look like in the screen in HEX decimal.
Yes it is true android has following types of devices
LDPI
MDPI
HDPI
XHDPI
http://developer.android.com/guide/practices/screens_support.html
this link gives you all the description
and ya you have to create icons and images supporting to all the devices resolution wise.
There are various devices with various screen sizes.
Usually, they are mentioned as LDPI, MDPI, HDPI or XHDPI devices.
Although, in coding there are many things to be kept in mind so that you achieve a good uniform design in all your devices !
Refer to this link. It is always good to follow official sites, rather than other tutorials out there. Make a habit of using relativelayout !
Also in the link you can explore many things to get the knowledge of designing in Android.
My application is supporting 3 type of density ldpi (120),mdpi(160),hdpi(320) and for that we have three folder for resources (ldpi,mdpi,hdpi).
But my problem is occurring in HTC sensation XE (540x960) having density ~256 dpi.and my resources is stretched.
In manifest file
<supports-screens android:xlargeScreens="false" />
means i am not supporting for xlarge screen so does 540x960 come in high density??.
How can i overcome this problem???
Android Multiscreen Support issue says "You can also use a combination of density and size qualifiers but that still leaves some room for two different resolutions falling into the same bucket."
What should be the name of drawble folder for this kind of resolution??
or is there any other way to short out this issue.
EDIT : My problem is not with layout, my problem 540x960 come in HDPI but my hdpi drawbles are designed related to 480x800
Help me..
Thanks in advance..
you can use below combination for Layout for HTC sensation XE (540x960) :
res/layout-w540dp-h960dp/layout.xml
this will use for pick layout for this device and for drawable it will pick image from hdpi because in this developer site 256 dp come in range of hdpi . http://developer.android.com/guide/practices/screens_support.html.
hope this will help you.
Your problem is that you have designed your bitmaps for a particular screen size rather than screen density.
Plainly put, you should not do that. There are a huge number of different form factors and screen sizes out there, and you cannot hope to have graphics sized for all of them. So you fix this issue for 540x960 screens... what then with your users who are on 480x854 displays (most hdpi motorola devices)? Will you include different graphics for 1024x720 and 1280x720 displays if you're developing for that? What about 1280x800?
Granted - it can be a pain to deal with these issues, but that is the price we pay for diversity of devices. And Google has provided a fair amount of powerful tools at our disposal to deal with this.
When you are designing an app for Android, you need to think of the design as if you were designing a website - not a desktop (or IOS) program. All (or most) of the tricks that you use for designing a website also apply here - plus you have the density-awareness and 9.patch tools.
And if you really cannot adjust your graphics/layout to the screen without messing it up, you can always center the layout on the display (or align it left or right, depending on what you think looks best).
Edit:
As I mention above, the core to flexible UI design in Android is to think of your app like a web site. Roman Nurik has an article discussing this on the Android blog.
http://android-developers.blogspot.com/2011/09/thinking-like-web-designer.html
Apart from that, it is mostly covered by the Android site, etc.
http://developer.android.com/training/multiscreen/index.html
Using the right layouts and 9-patch images (not always - sometimes static images are better) will allow you to create designs that look good on all phones. But you have to realize that - like a website designed in a browser - you do not and can not have 100% control over how things are displayed on every single device. What you need to achieve is that it is still accessible and good-looking even when displayed on a device that you did not anticipate beforehand.
You have to name the drawable as per your pixel density and the screen size. The calculation is here...
dpi = sqrt (540^2+960^2) / 4.3"(Device size) = ~256 dp = px / (dpi / 160) = 540 / (dpi / 160) = 330
The drawable will be named as drawable-sw330dp. I have tested this. And this works good. No problem with other drawables either. Layout Will be layout-sw330dp
Or you can try this by drawable-sw540p. I haven't tested it yet. But I guess it will work good. Layout Will be layout-sw540p
I developed and application and uploaded all the images in the respective drawable folders (different pixels for different desnities).
Now I am confused when it comes to layout. If I used the layout editor with 4.1 inc (thats considered Med screen I guess?) everything looks great.
Now when I use the editor with 10.1 inch which is the tablet, then I see icons very small and the text is small. I have not run the emulator yet.
So I am wondering:
1- why would the text be small although I didn't specify text size? Shouldnt scalle appropriately? or should I give it a specific size for bigger layouts?
2- Why the icons are small given that I provided the different drawables? I thought it would scale up accordingly.
Please don't give me the supporting multiple screens link in android as an answer, as I already went through it and still no luck with above. I need your personal advice as I think I am missing something here
Thank you so much in advance
Android support for different screens is a little tricky. That's because you can have large, small, medium and xlarge screens, plus high, medium and low density ones. There are a dozen possibilities (xlarge low density, small high density) and not a single resolution is defined. So you must know the principles which the API is designed upon and must define your layout thinking about the role the widget has inside your UI. You also must bear in mind that your layout won't be pixel perfect on 100% of devices, so your aim should be being usable on all possible devices.
In your specific case it seems that either you don't manage to specify the correct resources, or the system doesn't pick up the right ones for you, but I must remark that it doesn't make sense on Android to talk about big, small and scale: you should design your layout with a (good) webdeveloper mindset, who daily deals with tons of different displays, resolutions, physical sizes and even devices.
I also suggest not using the graphical builder if you are new to Android, because you really need to know how Android lays out components, otherwise you will come back to SO very often :)
If you do not specify the text size in your layout file Android will take the default value, which is most likely in DIP (density independent pixel) therefore it will be the same physical size on any devices. That should explain why the text looks so small on your 10 inch tablet.
What I would do in this case is have 3 layouts for each activities and specify the text size for larger devices (given you already like the look on phones) and put them in this folder scheme :
res/layout/layout.xml // phones
res/layout-sw600dp/layout.xml // 7” tablets
res/layout-sw720dp/layout.xml // 10” tablets
Information above was taken in this article. I have this applied in my current personal project and so far it works like a charm.
Secondly, as far as icons go, I'm no drawable expert but if you provided the same file in each folder (like I think you did from what I understand in your question), it will not make it scale. You'll have to create 4 difference icons, one for each possible pixel density.
Information about icon sizes can be found on this page.
Hope this is of some help to you.
My experience with the Android device zoo drew me to the sad conclusion that the built-in screen size/layout facility is useless. Cases in point, straight from support:
a 10 inch tablet with Android 2.2. Screen size xlarge is not supported by Android 2.2
Kindle Fire, which is 7 inch and claims it's xlarge.
I ended up putting all three layouts (med/large/xlarge) into layout, loading one based on run-time density and resolution, and providing an option for user to force a specific layout.
Just sayin'.
The designer of our company wants me to give him the resolutions of Android tablets so he will start designing a new app.
I know there are a lot of different resolutions (listed here: Android Tablets computers).
I also know about the division of Android to the different dpi's (ldpi, mdpi, ...).
My questions :
What should I tell the designer? He obviously not supposed to make a version for each resolution. Besides, some of the resolutions listed in the link above are in the same dpi, so which one should I choose?
Considering the fact the app is going to run only on tablets, what are the dpi classes I should use? Only hdpi and xhdpi? Or should I still use all 4 classes and limit the <supports-screens> tag in the manifest?
Is there a resolution that represent each of the dpi classes that I
should stick to?
I've done some reading about 9-patch. What's the point of using it if I still need to deliver a version for each dpi??
Thanks in advance!
The questions contain so much information.
1 Try to read the article and the references in it.
http://www.androiduipatterns.com/2011/11/design-patterns-for-responsive-android.html
You could also have a look at the web site for android design.
http://developer.android.com/design/index.html
In one word, designing for android tablets is more like designing websites. You cannot just design for one resolution.
2 Considering you are developing for tablets, it's necessary to support mdpi and hdpi. If the apps could be installed on phones, maybe xhdpi is also needed. It's not very strict.
3 dpi(dots per inch) = pixels per inch. So dpi is like density, it do not have strict relationship with resolution. But there is still a sheet could help you, try to find it in the following page
http://developer.android.com/guide/practices/screens_support.html
4 9-patch resource is very useful. With which a small png could stretch to any size without distortion. And it could also help to reduce the size of your resources.
In most situation, you do not have to make 9-patch for each dpi, since it could stretch to any size you want. But if the 9-patch png contain some information itself, like min height and padding, it's necessary to make different versions.
Here is what I would do:
See what combinations you have. There are mostly 3 resolutions for tablets (1280x800, 1024x600, 800x480) and mostly 2 densities (hdpi and mdpi). That is at most 6 versions. Select a few matching your most logical targets (I would choose xlarge mdpi (9" 1280x800), large mdpi (7" 1024x600) and normal-hdpi (4-5" 800x480) and design on these.
Some graphical elements don't need to be designed for each combinations, like backgrounds, may be buttons… Here comes the 9-patch. To be put in drawable-nodpi folder. One resource fits all.
Do one version first on you major target, then see how it fits on the other targets, and consider adjustments from there.
Use ScrollViews if you don't want to position every item pixel-perfectly on each device.
When I design Android apps, I use HVGA resolution in the emulator. I saw (on YouTube and other videocasts) that some developer use higher resolution like WVGA or similar.
Which resolution is best for designing nowadays Android apps? Why?
Why restrict yourself to one resolution? You are perfectly able to customize the design for all screen resolutions. See this page in the developer docs: Supporting Multiple Screens
It tells you how to support multiple screen sizes and how to test them.
The best resolution to design for is the resolution that the user is using. That sounds obvious, but as there are a plethora of Android devices, there are also a plethora of supported screen resolutions. What you need to do is make sure you design your app to support a multitude of resolutions so that it looks great on all devices, not just one. #Tchami points out how to get started.
All of them, simultaneously, because there's nothing more annoying than getting 95% of the way through an app and discovering your boss is testing it on an HTC Desire, her boss is testing it on a Galaxy Tab, and they both want it to look right for them.
For your design time, Tackle multiple resolutions first, landscape/portrait second. Build a ton of emulators with a ton of different screen sizes, including tablets. Those are my priorities. You can always make someone use something that works in the orientation they dont want, but you cant make them use something that doesnt work in either orientation.
The other comments here are all correct that it should work at all resolutions. If you want to know which ones you should focus on and make pixel perfect, use the Android Device Dashboard, which provides a breakdown of all the screen sizes and densities of the last week worth of Market users. This will let you know which screen types are especially worth targeting (normal hdpi and normal mdpi dominate at the moment)
http://developer.android.com/resources/dashboard/screens.html
I always design 768px X 1280px canvas size, this is about xHdpi resolution and you should resize all elements in canvas to 4 sizes or 5 which are mdpi,hdpi,xhdpi(baseline),xxhdpi,xxxhdpi(optional) then you have a device independent design for your app.
mdpi = 160dp = %50 (resize)
hdpi = 240 dp = %75 (resize)
xhdpi = 320 dp = %100 (baseline)
xxhdpi = 480 dp = %150 (resize)
xxxhdpi = 640 dp = %200 (resize)