I'm writing an Android app for Android tablets, my tablet is a 10.1" 600x1024 Archos tablet running Android 2.2
When I throw the app to my device it works fine, no problems at all, but when I throw it to an AVD (600x1024, tested with 120, 160, 240 and 320 dpi) it will only ever open in a small area of the display. The screen shows as a 600x1024 screen and the standard android desktop shows fine, but the app will only display in a 480x320 box in the middle of the screen.
An example: This is the AVD running the desktop - http://www.flickr.com/photos/45270706@N03/5960464995/
And this is it running my app - http://www.flickr.com/photos/45270706@N03/5961001468/
As you can see, the app believes the screen size is 480x320 - the code used to display this text is:
canvas.drawText("Screen Width = " + canvas.getWidth(), 50, 20, paint);
canvas.drawText("Screen Height = " + canvas.getHeight(), 50, 40, paint);
Which should be accurate enough.
I'm either doing something wro开发者_如何学运维ng in my code (which I don't think I am as a new 'hello world' does the same), doing something wrond when setting up the AVD (though it does exactly the same if I use the GalaxyTab AVD) or I don't know what else.
I've had a look around at some existing threads but they don't seem to cover the issue I'm having.
If it makes any difference, I'm using Netbeans and NBAndroid as my IDE.
Any help would be greatly appreciated and I will happily provide any of my code if it would help resolve the issue.
Thanks in advance.
In your AndroidManifest.xml you should make sure you have enabled support for all possible screen sizes and that you are targeting above version 3 (usually a good idea to target for maximum SDK version and support lowest possible by your API calls)
...
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="11"/>
<supports-screens
android:xlargeScreens="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true" />
</manifest>
精彩评论