AndroidApplication类学习
AndroidApplicationextends Activity implements Application
首先继承了android的Activity,并实现了Application接口
public void initialize (ApplicationListener listener, AndroidApplicationConfiguration config)
{
//创建2D的渲染对象
graphics = new AndroidGraphics(this, config, config.resolutionStrategy == null ? new FillResolutionStrategy(): config.resolutionStrategy);
//创建输入对象
input = new AndroidInput(this, graphics.view, config);
//创建音频对象
audio = new AndroidAudio(this);
//创建文件操作对象
files = new AndroidFiles(this.getAssets());
this.listener = listener;
this.handler = new Handler();
Gdx.app = this;
Gdx.input = this.getInput();
Gdx.audio = this.getAudio();
Gdx.files = this.getFiles();
Gdx.graphics = this.getGraphics();
//设置全屏模式
try
{
//没标题
requestWindowFeature(Window.FEATURE_NO_TITLE);
}
catch (Exception ex)
{
log("AndroidApplication", "Content already displayed, cannot request FEATURE_NO_TITLE", ex);
}
//设置全屏模式
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
//也可以用下面的清除Flag
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
//设置运行的显示View
//DefaultGLSurfaceView
setContentView(graphics.getView(), createLayoutParams());
createWakeLock(config);
更多相关文章
- Android Bitmap对象与byte[]相互转换
- Android 整屏截图与区域指定view或layout截屏并返回bitmap对象
- Android 实现夜间模式
- 使用意图在Activity之间传递数据小插曲__传递自定义的序列化对象
- Android之启动模式
- Android M新特性Doze and App Standby模式详解
- MTP模式与USB存储模式(MTP in Android)
- android Sqlite数据库对象模型ORMLite框架学习
- Android StrictMode 严苛模式