作者eva123eva (龍)
看板AndroidDev
標題[問題] 該如何隱藏Navigation bar(海苔條)
時間Tue Sep 1 09:29:28 2015
最近想把APP的畫面做到全銀幕
但是很多裝置的Navigation bar都直接吃掉一排
看過官方的developer的寫法:
View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but
as
// a general rule, you should design your app to hide the status bar whenever
you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
這方法有效,但只要一碰觸到畫面
Navigation bar就會再浮現出來
請問該如何將固定不要讓它跑出來?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.134.22.57
※ 文章網址: https://www.ptt.cc/bbs/AndroidDev/M.1441070970.A.EB9.html
→ egaryer: 他下面第一二點再看看? 應該就是解答 09/01 11:39
→ king5201: 基於安全性原生沒辦法不要跑出來喔~除非root或貼貼紙(誤 09/04 01:55
推 joy0520: 以前試過在主layout設定好touch event,幾秒後再照原文設 09/05 02:24
→ joy0520: 定一次,將decor縮回去 09/05 02:24