zoukankan      html  css  js  c++  java
  • MyActivityl类

    import android.app.Activity;
    import android.content.pm.ActivityInfo;
    import android.os.Bundle;
    import android.view.KeyEvent;
    import android.view.Window;
    import android.view.WindowManager;
    
    
    public class MyActivity extends Activity {
    	MySurfaceView mySurfaceView;
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            //设置为全屏
            requestWindowFeature(Window.FEATURE_NO_TITLE); 
    		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN ,  
    		              WindowManager.LayoutParams.FLAG_FULLSCREEN);
    		//设置为横屏模式
    		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    		
    		//初始化GLSurfaceView
    		mySurfaceView = new MySurfaceView(this);
    		
    		//切换到主界面
    		setContentView(mySurfaceView);
    		
    		mySurfaceView.requestFocus();//获取焦点
    		mySurfaceView.setFocusableInTouchMode(true);//设置为可触控          
        }
        @Override
        protected void onResume() {
            super.onResume();
            mySurfaceView.onResume();
            mySurfaceView.lightFlag=true;
        }
    
        @Override
        protected void onPause() {
            super.onPause();
            mySurfaceView.onPause();
            mySurfaceView.lightFlag=false;
        }  
        public boolean onKeyDown(int keyCode,KeyEvent e)
        {
        	switch(keyCode)
            	{
        	case 4:
        		System.exit(0);
        		break;
            	}
        	return true;
        };
    }

  • 相关阅读:
    python协程爬取某网站的老赖数据
    python异步回调顺序?是否加锁?
    go语言循环变量
    使用memory_profiler异常
    安装python性能检测工具line_profiler
    等我!
    pytorch代码跟着写
    Python异常类型总结
    Python项目代码阅读【不断更新】
    夏令营体会
  • 原文地址:https://www.cnblogs.com/Anzhongliu/p/6092106.html
Copyright © 2011-2022 走看看