Hello Everyone.........
I am working on android tablets that supports 1280x800 and 1024x600 resolution. What is the best approach for UI design to use dip or px for layout designing. My problem is I want 开发者_Python百科to support all Android Tablets in market with both of these resolutions but there LCD density may vary between 160 to 240 dpi.
What to do in this situation?
Android tablets have 240 dpi density or 160 dpi density or may have both?
Please tell which tablets devices have which density support?
Is it possible to workon both densities with same screen resolution through same xml layout?
yes make sure, we make a single layout thate work for all screen or tabs in any density. Android provide multiple support screen features.
<supports-screens android:resizeable="true"
android:largeScreens="true" android:normalScreens="true"
android:anyDensity="true"></supports-screens>
and also putup all imeges in
- hdpi folder
- mdpi folder
- ldpi folder
For layout designing dip is definitely the best approach because you have density independence :
http://developer.android.com/guide/practices/screens_support.html
As far as I know, since dpi is dots per inch if you have one resolution you should only have one density.
For calculating easily density see :
http://members.ping.de/~sven/dpi.html
http://en.wikipedia.org/wiki/Comparison_of_Android_devices#Tablet_computers
I have just written a blog post to solve your problem: http://onemanmobile.blogspot.com/2012/04/how-to-scale-your-android-layouts-to.html
This will give you a tool so you only have to define your layout xml-files for a single density bucket (small/normal/large/xlarge) and have it scale proportionally for tablets and small devices.
精彩评论