<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > 屏幕單位 密度 分辨率區分

屏幕單位 密度 分辨率區分

作者: 時(shí)間:2016-09-12 來(lái)源:網(wǎng)絡(luò ) 收藏

1、概念理解

本文引用地址:http://dyxdggzs.com/article/201609/304714.htm

術(shù)語(yǔ)

說(shuō)明

備注

Screen size(屏幕尺寸)

指的是手機實(shí)際的物理尺寸,比如常用的2.8英寸,3.2英寸,3.5英寸,3.7英寸

摩托羅拉milestone手機是3.7英寸

Aspect Ratio(寬高比率)

指的是實(shí)際的物理尺寸寬高比率,分為long和nolong

Milestone是16:9,屬于long

Resolution(分辨率)

和電腦的分辨率概念一樣,指手機屏幕縱、橫方向像素個(gè)數

Milestone是854*480

DPI(dot per inch)

每英寸像素數,如120dpi,160dpi等,假設QVGA(320*240)分辨率的屏幕物理尺寸是(2英寸*1.5英寸),dpi=160

可以反映屏幕的清晰度,用于縮放UI的

Density(密度)

單位英寸中的像素數量,resolution/Screen size可以反映出手機密度

一般分為低、中、高密度

Density-independent pixel (dip)獨立像素

指的是邏輯密度計算單位,dip和具體像素值的對應公式是dip/pixel=dpi值/160

頁(yè)面布局的基本單位

2、屏幕單位區別

1)dip:設備獨立像素,與屏幕密度有關(guān)

2)dp:和dip是一樣的

3)px:pixels(像素),這是絕對像素,是多少就永遠是多少不會(huì )改變

4)sp:scaled pixels(放大像素). 主要用于字體顯示best for textsize

結論:根據google的推薦,像素統一使用dip,字體統一使用sp

3、dip與px換算

px=dip*屏幕密度(屏幕密度用getDisplayMetrics().density獲得)

public static int dip2px(Context context, float dipValue){

final float scale = context.getResources().getDisplayMetrics().density;

return (int)(dipValue * scale + 0.5f);

}

public static int px2dip(Context context, float pxValue){

final float scale = context.getResources().getDisplayMetrics().density;

return (int)(pxValue / scale + 0.5f);

}



關(guān)鍵詞:

評論


相關(guān)推薦

技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>