2012年5月25日

android获取屏幕尺寸、密度

摘要: 有些时候,我们需要获取Android手机或Pad的屏幕的物理尺寸,以便于界面的设计或是其他功能的实现。下面就介绍讲一讲如何获取屏幕的物理尺寸:从网上找过不少资料,发现获取屏幕尺寸并不是很复杂的编程操作,下面的代码即可获取屏幕的尺寸。在一个Activity的onCreate方法中,写入如下代码:DisplayMetrics metric = new DisplayMetrics();getWindowManager().getDefaultDisplay().getMetrics(metric);int width = metric.widthPixels;// 屏幕宽度(像素)int heig 阅读全文

posted @ 2012-05-25 13:58 明明的天天 阅读(307) 评论(0) 推荐(0)

android单位详解2(小翻译)

摘要: http://developer.android.com/guide/practices/screens_support.htmlTerms and conceptsScreen sizeActual physical size, measured as the screen's diagonal.For simplicity, Android groups all actual screen sizes into four generalized sizes: small, normal, large, and extra large.Screen densityThe quanti 阅读全文

posted @ 2012-05-25 11:53 明明的天天 阅读(505) 评论(1) 推荐(0)

导航