Android emulator resolution setting is not working
I change the Android emulator 2.2 resolution to WVGA800. But when I tried to get the width and height, it was still 320 x 533. I tried another application using the surfaceview, and it changed to 480 x 800. Why? It confused me. Did I make any mistake in the code or the setting. Thanks for your helping.
public class Mytest extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
DisplayMetrics dm=getResources().getDisplayMetrics();
int screenWidth=dm.widthPixels;
int screenHeight=dm.heightPixels;
this.开发者_Go百科setTitle("X="+screenWidth+", Y="+screenHeight);
setContentView(R.layout.main);
}
}
You are getting the pixels after division by pixel density. Peep this hot action: Android: Showing wrong screen resolution
精彩评论