Android Screen

      w    h   density  physical w  physical h

QVGA  240px    320px    120dpi        2in        2.666in   
HVGA  320px    480px    160dpi        2in        3in        9/8
WVGA  480px    800px    240dpi        2in        5in        3/5

density = pixels / inch
pixels = dip * (density / 160)

inchs = dip / 160

 

DisplayMetrics dm = new DisplayMetrics();

getWindowManager().getDefaultDisplay().getMetrics(dm);
int widthPixels= dm.widthPixels;
int heightPixels= dm.heightPixels;
float density = dm.density;
int screenWidth = widthPixels * density ;
int screenHeight = heightPixels * density ;

posted on 2011-01-21 15:22  爱吃草莓的维尼  阅读(240)  评论(0编辑  收藏  举报

导航