AndroidApplication类学习

AndroidApplication extends 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);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值