Android Alert Dialog with extra background

前端 未结 5 1405
半阙折子戏
半阙折子戏 2020-12-20 18:11

I recently migrated my app to Material Design and I stumbled upon this problem with my Alert Dialogs:

\"dialog

5条回答
  •  爱一瞬间的悲伤
    2020-12-20 19:13

    Add below styles . You have to customise background also.

        @null
        @android:color/transparent
        true
        @null
        @null
        @android:style/Animation.Dialog
        false
        @android:color/transparent
    

    Using below also works

    @android:color/transparent
    @android:color/transparent
    

    Also You can set in your code by using

    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    

    and this should be before setContentView

    dialog.setContentView(R.layout.dialog);
    

提交回复
热议问题