2016-12-06 125 views
3

[導航欄] [1]的Android 6.0棉花糖如何禁用/隱藏導航欄/ SystemUI

我書面方式的應用程序和在的onCreate() - 功能我是禁用導航欄:

在Android 4.4的:

Runtime.getRuntime().exec("/system/xbin/su -c service call activity 42 s16 com.android.systemui"); 

在Android中5:

Runtime.getRuntime().exec("/system/xbin/su -c am stopservice -n com.android.systemui/.SystemUIService"); 
Runtime.getRuntime().exec("pm disable com.android.systemui"); 
Runtime.getRuntime().exec("kill 'processID of systemui'"); 

這工作得很好。 但兩者並不作品的Android 6

後...

Runtime.getRuntime().exec("/system/xbin/su -c service call activity 42 s16 com.android.systemui"); 

...的SystemUI /導航欄被禁用,而且觸摸。

及後...

Runtime.getRuntime().exec("/system/xbin/su -c am stopservice -n com.android.systemui/.SystemUIService"); 
Runtime.getRuntime().exec("pm disable com.android.systemui"); 
Runtime.getRuntime().exec("kill 'processID of systemui'"); 

...的SystemUI /導航是3秒關閉,然後再次出現。

任何人可以幫助?

+0

你設置編程爲邏輯3秒多關於細節請參閱此鏈接:-https://developer.android.com/training/system-ui/immersive.html – Joy

+0

這工作對我來說(android 6.0.1 )https://stackoverflow.com/a/41856988/3547724 –

回答

1

我仍在尋找這個問題的一個方便的答案,但目前我使用:

禁用狀態欄

Runtime.getRuntime().exec("settings put global device_provisioned 0");

啓用狀態欄

Runtime.getRuntime().exec("settings put global device_provisioned 1");

這是不完美,但htat是第一步。

+0

謝謝Yoleth!非常好的第一步。 – iMorphborg

+0

您是否找到解決方案?上述解決方案不適用於我:( – alexislg