安卓:状态栏的效果腾起 [英] Android: Jumping effect of Status Bar

查看:154
本文介绍了安卓:状态栏的效果腾起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的应用程序有问题。我用的是全屏幕选项,像这样:

I have a problem with my app. I use the full screen option like so:

public void setFullscreen() {
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

不过,后来在比赛中,当我告诉了AlertDialog的帮助/
信息,状态栏回来的几分之一秒和
再次消失创建一个闪烁或跳跃的效果。此外,
对话本身不集中,因为它应该,仿佛它认为
有一个状态栏。

But, later during the game, when I show the AlertDialog for Help / Info, the status bar comes back for a fraction of a second and disappears again creating a flashing or jumping effect. Also, the Dialog itself is not centered as it should, almost as if it thought there was a status bar.

下面是我如何显示对话框:

Here is how I display the dialog:

protected Dialog onCreateDialog(int id) {
TextView tv;

switch (id) {
case MENU_HELP:
       tv = new TextView(this);
                   tv.setText(R.strings.help_msg);

       return new AlertDialog.Builder(BlackJackView.this)
       .setIcon(android.R.drawable.ic_menu_help)
       .setTitle("How-To")
       .setView(tv)
       .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                   public void onClick(DialogInterface dialog, int whichButton) {
                          /* User clicked OK so do some stuff */
                   }
       })
       .create();
  }

  ………

  }
  return null;
}

有谁知道什么可能会导致此出现/消失?
我如何让它停止这种跳跃行为?

Does anyone know what may be causing this appearing / disappearing? How do I make it stop this jumping behavior?

感谢您的帮助。

推荐答案

只需设置对话框的窗口切换到全屏模式太

Simply set dialog's window to fullscreen too

Dialog mPreviewDialog = new Dialog(this);

Window dialog_window = mPreviewDialog.getWindow();
dialog_window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);  
mPreviewDialog.show()

它修复了状态栏闪烁。

It fixes the blinking of status bar.

这篇关于安卓:状态栏的效果腾起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆