Libgdx Android set screen resolution
题
I have not found any way to successfully set a screen resolution on my android device. when i run my libgdx app on my galaxy note, it automatically sets the applications screen resolution to 800x600 while my phone (Galaxy note) got a 1280x800 resolution. there are no scaling. just a small screen with huge black boarders around.
I have tried to use Gdx.graphics.setDisplayMode to force a greater resolution but without any success.
my application is very simple. i followed: http://code.google.com/p/libgdx/wiki/ProjectSetup and added SpriteBatch and Textures from: http://code.google.com/p/libgdx/wiki/SpriteBatch
I will only use textures in this app. what have i missed? what is wrong?
the following code:
com.badlogic.gdx.Graphics.DisplayMode[] modes;
modes = Gdx.graphics.getDisplayModes();
for (com.badlogic.gdx.Graphics.DisplayMode mode : modes) {
System.out.println(mode);
}
Only give the line: 480x320, bpp 0, hz: 0
I get a message "MALI_NO_HANDLE in function _mali_base_common_mem_alloc because the requested_size is 0" can this be related? any ideas?
解决方案
I put this in the AndroidManifest.xml and it seemed to fix the issue:
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="13" />
Hope this works for you.
其他提示
You can not set the screen resolution on Android, as documented in the Javadocs you used (Graphics#setDisplayMode).