[android]代码库
public static String getDisplay(
Context context )
{
DisplayMetrics metrics = new DisplayMetrics();
WindowManager manager = (WindowManager)context.getSystemService( Context.WINDOW_SERVICE );
Display display = manager.getDefaultDisplay();
display.getMetrics( metrics );
DisplayMetrics dm = new DisplayMetrics();
@SuppressWarnings( "rawtypes" )
Class c;
try
{
c = Class.forName( "android.view.Display" );
@SuppressWarnings( "unchecked" )
Method method = c.getMethod( "getRealMetrics" , DisplayMetrics.class );
method.invoke( display , dm );
return dm.widthPixels + "*" + dm.heightPixels;
}
catch( Exception e )
{
return metrics.widthPixels + "*" + metrics.heightPixels;
}
}
by: 发表于:2017-09-27 09:58:29 顶(0) | 踩(0) 回复
??
回复评论