新版本的AndroidFramework和老版本的实现全屏起来有些不同。这里只给出新版本的Android实现全屏代码。
packagepub.tetris;
importandroid.app.Activity;
importandroid.os.Bundle;
importandroid.view.Window;
importandroid.view.WindowManager;
publicclassTetrisActivityextendsActivity{
/**Calledwhentheactivityisfirstcreated.*/
@Override
publicvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
<wbr style="line-height:25px">/**全屏设置,隐藏窗口所有装饰*/</wbr>
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
/**标题是属于View的,所以窗口所有的修饰部分被隐藏后标题依然有效*/
requestWindowFeature(Window.FEATURE_NO_TITLE);<wbr style="line-height:25px"></wbr>
TileViewtile=newTileView(this);
Tetristetris=newTetris();
tetris.init(tile);
Threadengine=newThread(tetris);
setContentView(tile);
engine.start();
}
}
packagepub.tetris;
importandroid.app.Activity;
importandroid.os.Bundle;
importandroid.view.Window;
importandroid.view.WindowManager;
publicclassTetrisActivityextendsActivity{
/**Calledwhentheactivityisfirstcreated.*/
@Override
publicvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
<wbr style="line-height:25px">/**全屏设置,隐藏窗口所有装饰*/</wbr>
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
/**标题是属于View的,所以窗口所有的修饰部分被隐藏后标题依然有效*/
requestWindowFeature(Window.FEATURE_NO_TITLE);<wbr style="line-height:25px"></wbr>
TileViewtile=newTileView(this);
Tetristetris=newTetris();
tetris.init(tile);
Threadengine=newThread(tetris);
setContentView(tile);
engine.start();
}
}