2015-11-05 135 views
1

我有一個問題隱藏導航欄在Android屏幕的底部。 我試過的每個解決方案都不能像我想要的那樣工作,除了一個。 使用新條目'qemu.hw.mainkeys = 1'修改build.prop可以正常工作,但會禁用整個android系統的導航欄。 有沒有可能禁用這樣的導航欄只適用於一個應用程序?如何在android應用程序中永久隱藏導航欄?

+1

[永久隱藏導航欄上的活動]的可能重複(http://stackoverflow.com/questions/1671) 3845 /永久隱藏導航欄上活性) –

回答

0

試試這個:

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);
(Source)

0
View decorView = getWindow().getDecorView(); 
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; 
decorView.setSystemUiVisibility(uiOptions); 

使用此代碼的onCreate(),它會隱藏狀態欄和導航欄,直到用戶從屏幕頂部向下滑動