Build your activity designs based on fragments Use the action bar Implement flexible layouts 600*1024dp 400*682dp Xoom 10.1 in xlarge 150dpi mdpi 800*1280 800*1280dp DPI G.DPI
G.DPI 大部分等于真实DPI最临近的G.DPI。
如果DPI正好在两个G.DPI正中间怎么办?
G.DPI可能和DPI相差很多。
Samsung galaxy tab Origin of the problem 问题的由来 Fragmentation
上千种android设备。
不同的平台版本。 不同的屏幕尺寸、分辨率。 不同的输入方式。 Platform version
From v1.5 to v4.1. 8 main version. 14 sub version.
Web Gallery Responsive mobile design
Same content, same logical, but different representation.
同样的内容,同样的逻辑,不同的展示方式。
Use configuration qualifiers to provide different layout for different devices.
பைடு நூலகம் Media queries contain two components:
A media type. (screen, print) A media feature(max-device-width) and query value(800px).
Use media queries to filter css depend on device info. large normal normal large normal 186dp 256dpi 280dpi 170dpi 170dpi mdpi hdpi xhdpi mdpi hdpi 480*800 540*960 800*1280 600*1024 600*1024 480*800dp 360*640dp 400*640dp
Small and Normal devices take over 90%. These devices are nearly all handsets. Handset qualifier
G.SIZE: small/normal Default Orientation: portrait RES.(dp): 426dp x 320dp - 640dp x 480dp.
根据G.DPI,系统将dp units和drawables换算调整为 适配设备的大小(px). A Button (100*100dp) and a icon (48px*48px in mdpi)
Go back to see first demo. Support general handset
RES.(dp) has a much smaller range. device G.SIZE small normal normal G.DPI ldpi mdpi hdpi RES. px RES. dp 320*428dp 320*480dp 320*533dp HTC wildfire HTC hero HTC desire Supporting Multiple Screens in Android Android多屏幕适配 Preface
Author:
Ren Fei. Android developer Buding Mobile / Innovation Works
Official answer: Think like a web designer. Responsive web design
Build something that works on any possible width or device instead of something that works on all current widths and devices. Relationships
RES. + SIZE DPI
DPI G.DPI (mostly) G.DPI + RES. G.SIZE
Effect of G.DPI
Developers do not need to care about real density. RES.(px). are aggregated to RES.(dp). Screen RES. iPhone vs. Android Android System Support Android系统支持 What does android do ? Some definition
Screen resolution
480*800 3.7" 252dpi Screen size A simple demo 320*480px mdpi 480*800px hdpi 540*960px hdpi 720*1280px xhdpi Support more devices (handset & tablet) 如何支持更多的设备? The first guideline
Develop one app for all devices. How to support?
Develop a scalable app.
Use wrap_content, fill_parent. Use dp not px. Use LinearLayout/RelativeLayout, not AbsoluteLayout. Provide different drawables for different dpi. Use more 9-patch drawable. … Screen sizes