Screen Size:
屏幕对角线的长度单位英寸,1英寸=2.54厘米
Resolution
在横纵线上的像素点数单位是px,1px=1个像素点一般以纵向像素*横向像素,如1920*1080
Screen pixel density
指每英寸上的像素点数(屏幕对角线上)单位dpi,与屏幕尺寸和屏幕像素有关1920*1080 dpi=445计算方式:sqrt{1920^2+1080^2}/尺寸(4.95对角线)
Px,dp,dip,sp
dp dip是密度无关像素以160dpi为基准,1dip=1px在320*480的机子上:160dpi 1dp=1px在800*480的机子上:240dpi 1dp=1.5pxsp 12,14,18,22 设置字体大小的时候不要设置奇数或小数,因为有可能会造成精度的丢失。
mdpi,hdpi,xdpi,xxdpi
存放相同图片的不同像素状态, 系统会更具设备的具体像素来选择不同的图片。同理不同像素下values中定义dimen的不同值。m 120~160(dpi)h 160~240xh 240~320xxh 320~480xxxh 480~640
Solution supports a variety of screen sizes (resolved in code)
###用wrap_content match_parent weight(权重) Weight 例如屏幕上有两个button,权重分别为1,2 当width设置为match_parent时,权重为1的button实际占屏幕的2/3,这是怎么回事呢? 原来,屏幕计算出的宽度=原来的宽度+剩余空间*控件所占的百分比##使用用相对布局,不用绝对布局 ##使用限定符 res/layout-large/ 大于7英寸的时候利用此布局 最小宽度 res/layout-sw600dp 方向限定符values-sw600dp-land/布局 水平方向 values-sw600dp-port/布局 竖直方向## 使用自动拉伸位图.9图片 左上是拉伸高度
Supports a wide variety of screen densities (images for each dpi) implement an Adaptive user interface process (primary solution for tablet adaptation)
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android Screen Adapter Solution