Android 實(shí)現(xiàn)全屏顯示的幾種方法整理
A、設(shè)置主題實(shí)現(xiàn)全屏
直接在AndroidManifest.xml文件中設(shè)定Activity主題為全屏模式
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
B、代碼實(shí)現(xiàn)全屏
代碼實(shí)現(xiàn)需要分兩步做,如下:
1、隱藏標(biāo)題欄
requestWindowFeature(Window.FEATURE_NO_TITLE);
2、隱藏狀態(tài)欄
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams
注意的是通過(guò)這種方法實(shí)現(xiàn)的時(shí)候需要將以上兩方法執(zhí)行在setContentView之前才有效。
感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
新聞熱點(diǎn)
疑難解答
圖片精選