Android實(shí)現(xiàn)全屏正確方法介紹
Android手機(jī)操作系統(tǒng)是由谷歌推出的一款基于Linux的開(kāi)源手機(jī)操作系統(tǒng)。我們可以在模擬器中對(duì)其進(jìn)行相應(yīng)的操作來(lái)實(shí)現(xiàn)各種功能以滿足用戶(hù)的需求。在這里就簡(jiǎn)要介紹一下Android實(shí)現(xiàn)全屏的相關(guān)方法。
新版本的Android Framework和老版本的實(shí)現(xiàn)起來(lái)有些不同。這里只給出新版本的Android實(shí)現(xiàn)全屏代碼。
- package pub.tetris;
- import android.app.Activity;
- import android.os.Bundle;
- import android.view.Window;
- import android.view.WindowManager;
- public class TetrisActivity extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- /**全屏設(shè)置,隱藏窗口所有裝飾*/
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
- /**標(biāo)題是屬于View的,所以窗口所有的修飾部分被隱藏后標(biāo)題依然有效*/
- requestWindowFeature(Window.FEATURE_NO_TITLE);
- TileView tile = new TileView(this);
- Tetris tetris = new Tetris();
- tetris.init(tile);
- Thread engine = new Thread(tetris);
- setContentView(tile);
- engine.start();
- }
- }
Android實(shí)現(xiàn)全屏相關(guān)操作方法就為大家介紹到這里。
【編輯推薦】