当显示对话框片段时,状态栏重叠,仅在Android4.4中

时间:2014-01-22 23:49:12

标签: android statusbar android-dialogfragment android-4.4-kitkat

我的问题只发生在Android 4.4 Kitkat上,当我显示一个对话框片段时,它的顶部将与状态栏重叠。我该如何处理这个问题?这是Kitkat的错误?

请参见此处的截图:

enter image description here

由于

1 个答案:

答案 0 :(得分:0)

    Dialog choiceDialog = new Dialog(this);
    choiceDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    Window window = choiceDialog.getWindow();
    int y = findViewById(R.id.bannerview).getTop();
    WindowManager.LayoutParams lp = window.getAttributes();
    lp.y = y;
    lp.dimAmount = 0;`enter code here`
    lp.windowAnimations = android.R.anim.fade_in;
    window.setAttributes(lp);
    choiceDialog.setContentView(R.layout.conversation_action_dialog);

我这样做是为了显示对话框,但它不是一个对话框片段可以帮助你