If I create an emulator on the command-line as:
./emulator.exe -avd my_avd -skin 480x360
The following calls all return a screen size of 480x320 and I have yet
to find a way to get the correct resolution returned without just hard-
coding it.
System.out.println("myView.getWH: "+myView.getWidth()
+"x"+myView.getHeight());
System.out.println("myView.getMeasuredWH: "+myView.getMeasuredWidth()
+"x"+myView.getMeasuredHeight());
Rect r = new Rect();
myView.getHitRect(r);
System.out.println("hitRect: "+r.toString());
Incidentally, the hitbox is reporting a height of 320, but I am still
getting touch events with coordinates above 320 if I press on the
bottom of the emulator screen.
If I use a copy of the root view (myView.getRootView()), I am returned
the same 480x320 values. The root view here is an instance of
com.android.internal.policy.impl.PhoneWindow$DecorView. The home
screen (this DecorView) and all of the built-in Android apps all
properly use the full 360 pixels specified as the height, but the only
way I can get my app to use all 360 is to hard-code its height. Hard-
coding for a particular resolution is obviously unacceptable since I
have to offer a one-build-for-all solution (and also because it's
extremely poor practice).
The properties of my_avd are Android 2.2, custom resolution 480x360
(as opposed to a built-in), Abstracted LCD density 160, Max VM
application heap size 24.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en