android 隱藏時間 Wifi 狀態欄

import android.view.Window;
import android.view.WindowManager;
/**
 * 隱藏狀態欄
 */
private void hideStatusBar()
{
    //定義全屏參數
    int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
    //獲得窗口對象
    Window myWindow = this.getWindow();
    //設置Flag標識
    myWindow.setFlags(flag, flag);
}

在啓動的MainActivity contentView之前調用一下即可,

//隱藏狀態欄
this.hideStatusBar();
setContentView(R.layout.activity_main);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章