A problem with android screen pixels

97 3
DisplayMetrics dm = new DisplayMetrics();
mActivity.getWindowManager().getDefaultDisplay().getMetrics(dm);
//dm.densityDpi = DisplayMetrics.DENSITY_HIGH;
Display display = mActivity.getWindowManager().getDefaultDisplay();
Log.e("display-width", display.getWidth()+"");
Log.e("Metrics-width", dm.widthPixels+"");

This is a very strange problem I've encountered today. Close to the blood. Ok, ok.
My machine is g7. It should be 480 * 800.
A first compilation of the comment isn't available. The width is 320.
And then I try to add a note that's 480.
And then my hand is base...............................

I've been able to understand. The people who understand.
Ps: stackoverflow found that many people were asked............................... !

2 Answers

146 5
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
119 5

As long as you set up minsdk> 4 in manfest, ok http://blog, csdn, net/xiaominghimi/art..

...