Android: Jumping effect of Status Bar
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);
}
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?
Thanks for all your help.
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.
精彩评论