DisplayMetrics issue on Android1.6 SDK

by lianwei » Sat, 19 Sep 2009 18:02:08 GMT


Sponsored Links
 I got a issue with DisplayMetrics.

  DisplayMetrics dm = new DisplayMetrics();
  getWindowManager().getDefaultDisplay().getMetrics(dm);
  Log.d("TEST", dm.widthPixels + "x" + dm.heightPixels);


If I do not specify the <uses-sdk android:minSdkVersion="4" /> or
<supports-screens android:anyDensity="true"></supports-screens>, then
the value of dm.widthPixels and heightPixels is wrong on QVGA and WVGA
screen. e.g. on QVGA, the return value is 320x427.

If this is a bug on Android1.6 SDK?

For chinese users, please see  http://easyandroid.com/bbs/viewthread.php?tid=19 
--~--~---------~--~----~------------~-------~--~----~



DisplayMetrics issue on Android1.6 SDK

by Dianne Hackborn » Sun, 20 Sep 2009 01:31:47 GMT


 That is intentional.  If you haven't said you support other densities than
the framework runs you in a compatibility mode to make it look like you are
on a medium density device.  By saying that you work with SDK 4, you are
also implying that you understand how to deal with densities.






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. How to open a dialog immediately after onResume? Is it even possible?

what code do you have in onResume() ?



--~--~---------~--~----~------------~-------~--~----~

2. Find contact with Phone Number

How can I find a contact enrty given a phone number?
--~--~---------~--~----~------------~-------~--~----~

3. Problem updating app in android market.

4. Android should provide remote database access for applications...

5. Tab Formatting

6. Review Sebelum Pre-Order Dibuka :)

7. pertanyaan seputar magi