Android Borderless Dialog

后端 未结 8 1817
囚心锁ツ
囚心锁ツ 2020-12-02 14:29

I have created an AlertDialog using AlertDialog.Builder, but the Dialog border takes up too much space on the screen. How do I remove the border? I have tried using another

8条回答
  •  一整个雨季
    2020-12-02 15:23

    Alright, I'll answer my own question. Basically, instead of using AlertDialog.Builder, create a regular Dialog using it's constructor, and use a suitable theme instead of the default Dialog theme.

    So your code would look something like this:

    Dialog dialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar);
    

    Hope this helps someone else.

提交回复
热议问题