本文介绍了身临其境的导航模式后,变成体积preSS或最小化,还原粘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
公共类MainActivity延伸活动{
@覆盖
保护无效的onCreate(包savedInstanceState){
。this.getWindow()getDecorView()setSystemUiVisibility(getSystemUiFlags())。
super.onCreate(savedInstanceState);
的setContentView(R.layout.activity_main);
}
私有静态诠释getSystemUiFlags(){
返回View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
}
}
第一次启动后,
在音量按钮pressed或最近的应用程序后,pressed两次
我看到下载快应用程序不会有这个问题。我不知道他们是如何省略了。 P>
解决方案
至于我,我用这个code
公共无效UiChangeListener()
{
最后查看decorView = getWindow()getDecorView()。
decorView.setOnSystemUiVisibilityChangeListener(新View.OnSystemUiVisibilityChangeListener(){
@覆盖
公共无效onSystemUiVisibilityChange(INT可见性){
如果((能见度和放大器; View.SYSTEM_UI_FLAG_FULLSCREEN)== 0){
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
});
}
和上的onCreate的说法。 :)
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
this.getWindow().getDecorView().setSystemUiVisibility(getSystemUiFlags());
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
private static int getSystemUiFlags() {
return View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
}
}
After first start
After volume buttons pressed or after recent apps pressed twice
I saw QuickPic app doesn't have this bug. I wonder how they omitted it.
解决方案
as for me, I use this code
public void UiChangeListener()
{
final View decorView = getWindow().getDecorView();
decorView.setOnSystemUiVisibilityChangeListener (new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
});
}
and called it on onCreate. :)
这篇关于身临其境的导航模式后,变成体积preSS或最小化,还原粘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!