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;
        };
    }

  • 相关阅读:
    【Jenkins】坑
    【Windows】修改hosts
    【Linux】防火墙操作-centos7
    【Linux】学习-centos 7
    【Jenkins】介绍、安装
    【Jenkins】有关网站
    【Jenkins】中文汉化
    【Jenkins】修改Jenkins插件为国内源
    python笔记之孤单的元组
    python笔记之水仙花数
  • 原文地址:https://www.cnblogs.com/Anzhongliu/p/6092106.html
Copyright © 2011-2022 走看看