已阅读5页,还剩69页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
supporting multiple screens in android android多屏幕适配 preface author: ren fei. android developer buding mobile / innovation works announcement: 本slide内容全部来自互联网,以及我自己的一点臆想,如 有错误,欢迎随便指出。 origin of the problem 问题的由来 fragmentation 上千种android设备。 不同的平台版本。 不同的屏幕尺寸、分辨率。 不同的输入方式。 platform version from v1.5 to v4.1. 8 main version. 14 sub version. screen sizes 2.6“ htc g16 3.2“ 3.7“ htc g5/g7 4.0“ 4.3“ samsung i9000/9100 7.0“ 7.7“ 8.9“ samsung galaxy tab 10.1“ moto xoom screen resolution iphone iphone 320*480 640*960 ipad 1024*768 2048*1536 screen resolution android qvga 240*320 wqvga 240*400 hvga 320*480 wvga 480*800 fwvga 480*854 svga 600*800 dvga 960*640 wsvga 1024*600 wxga 1280*768 qhd 540*960 hd 1280*720 screen res. iphone vs. android android system support android系统支持 what does android do ? some definition screen resolution 480*800 screen size 3.7“ screen density 252dpi dpi(dots per inch), xdpi, ydpi dpi= res. / size dip (density-independent pixel) px = dp * (dpi / 160) generalized size/dpi g.dpi: hdpi/mdpi/ldpi/xhdpi g.size: small/normal/large/xlarge generalized dpi definition g.dpig.dpi dpidpi 1 dp = ? 1 dp = ? pxpx ldpi (low density) 120 dpi 0.75 mdpi (medium density) 160 dpi 1 hdpi (high density) 240 dpi 1.5 xhdpi(extra-high density) 320 dpi 2 generalized size definition android does not currently support screens smaller than small screens. g.sizeg.size qualifier(at least)qualifier(at least) xlarge 960dp x 720dp large 640dp x 480dp normal 470dp x 320dp small 426dp x 320dp relationships res. + size dpi dpi = res. / size dpi g.dpi ? size g.size ? some model devicedevice sizesize g.sizeg.size dpidpi g.dpig.dpi res. res. pxpx res. res. dpdp htc wildfire 2.8 in small 140dpi ldpi 240*320 320*428dp htc hero 3.2 in normal 180dpi mdpi 320*480 320*480dp htc desire 3.7 in normal 252dpi hdpi 480*800 320*533dp dell streak 5.0 in large 186dp mdpi 480*800 480*800dp htc sensation 4.3 in normal 256dpi hdpi 540*960 360*640dp galaxy note 5.3 in normal 280dpi xhdpi 800*1280 400*640dp htc flyer 7.0 in large 170dpi mdpi 600*1024 600*1024dp galaxy tab 7.0 in normal 170dpi hdpi 600*1024 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 g.dpi是由手机厂商定义的。 选择标准是使新的设备能最好的适用于现有app。 size g.size size 和 g.size 并没有很明显的关系。 g.size是由res.(dp) 定义的。 参考g.size的下界限定。 res.(px) + g.dpi res.(dp) g.size 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). res.(dp) has a much smaller range. devicedevice g.sizeg.size g.dpig.dpi res. res. pxpx res. res. dpdp htc wildfire small ldpi 240*320 320*428dp htc hero normal mdpi 320*480 320*480dp htc desire normal hdpi 480*800 320*533dp htc sensation normal hdpi 540*960 360*640dp galaxy note normal xhdpi 800*1280 400*640dp galaxy tab normal hdpi 600*1024 400*682dp density independence 根据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 如何支持普通手机? handset features 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. 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. 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.develop one app for all devices. tablets和handsets没有明显的界限。 为不同的设备、分辨率开发不同的app耗费巨大且效果不佳。 anti-example: official guidelines build your activity designs based on fragments use the action bar implement flexible layoutsimplement flexible layouts implement flexible layouts how to implement flexible layouts in one app? 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. 与其为当前所有设备、大小做支持,不如去支持所有可能 出现的情况。 use css3 media queries. usually combine with fluid web design. media queries sample: 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. website demo /d/responsive-web- design/ex/ex-site-final.html 3 media queries divide width to 4 part. media (max-width: 400px) media (max-width: 600px) media (min-width: 1300px) web gallery responsive mobile design same content, same logical, but different representation. 同样的内容,同样的逻辑,不同的展示方式。 use configuration qualifiers to provide different layout for different devices. configuration qualifiers screen size: small/normal/large/xlarge density: ldpi/mdpi/hdpi/xhdpi orientation: port/land platform version: v3/v4/v11/v13 language: en/fr new screen size qualifiers smallest width sw600dp available width w600dp available height h600dp web design vs android design css vs layout css pixel vs dip ems vs sp css3 media query vs configuration qualifiers fluid web design vs scalable design responsive web design vs responsive mobile design app demos iosched2011 iosched2012 google play iosched2011 3 fragments 4 layouts iosched2011 layout/ layout-land/ iosched2011 layout-xlarge-land-v11/ layout- xlarge-v11 iosched2012 4 fragments 4 layouts iosched2012 iosched2012 layout/ layout-land/ iosched2012 layout-large-v11/ layout-large- land-v11/ google play version: 3.4.4 4 layouts generic_details.xml google play layout/ layout-land/ google play layout-w600dp-h540dp/ layout-w800dp- h540dp/ ui design patterns ui设计模式 android ui design patterns design pattern 对于一些普遍出现的问题的通用解决方法。 成熟的ui patterns能在不同的设备环境下自我调节。 here we introduce some useful patterns. action bar workspace dashboard slide navigation action bar replace the old titlebar. many functions: menu search navigation tab spinner up action mode split action bar action bar navigation(tab) action bar navigation(spinner)/split action bar/action mode action bar workspace a scrollable tabview. could combine with actionbar. workspace dashboard acted as the landing page and holds all main functions. dashboard slide navigation could replace the dashboard. make the navigation easier. appearance is better in tablets. slide navigation conclusion android系统实现的density independence 在多屏幕 适配中担当了很重要的角色。 在一个app中实现灵活、动态的布局。 think like a web designer 遵从系统的guideline,尽可能多的使用成熟的ui patterns. the end thanks for watching contact 欢迎各种交流与切磋 renfei email:renfeibuding.
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024-2025学年安徽省江淮协作区高二下学期期末联合监测物理试题(解析版)
- 2025-2026学年云南省部分学校高二上学期8月开学联考地理试题(解析版)
- 新教材部编人教版小学语文三年级下册赵州桥人教新课标教案
- 英语专四语法词汇题题型省公共课全国赛课获奖教案
- 小班生态文明教案模板(2025-2026学年)
- 产后出血的识别和管理产后出血预防处理指南版院内培训教案
- 九年级物理电磁铁及其应用新版北师大版教案
- 聘用软件开发工程师合同协议
- 聘用无人机操作员合同协议2025
- 2025年特许经营广告投放合同协议
- 全南县2025年公开选调机关事业单位工作人员历年真题库及答案解析(夺冠)
- 2026金开新能校园招聘备考题库带答案解析
- 2025年郑州水务集团有限公司招聘80人笔试模拟试卷带答案解析
- 创伤急救模拟教学的团队协作模拟演练
- 2024年厦门市住房和建设局及所属事业单位招聘辅助岗位人员笔试真题
- 慢性心衰相关认知功能障碍管理方案
- 蜱虫的课件教学课件
- 2025 年中国互联网助贷业务发展研究报告
- 水泥墩光伏安装施工方案
- 3套2025年发展对象考试100分试题(附全答案)
- 肥胖的危害课件
评论
0/150
提交评论