问题描述
我已经使用AlertDialog.Builder创建AlertDialog,但是对话的边框占用太多的空间在屏幕上。如何删除的边界?我已经使用其他活动来模拟一个透明背景的对话框中尝试过,但反复使用的对话框,并创建新的活动,每次推出一个显著量滞后。
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 Activity to emulate the dialog with a transparent background, but the dialog is used repeatedly, and creating a new Activity every time introduces a significant amount of lag.
从here提到它可以在ApiDemos被发现,但我似乎无法找到它。
The answer from here mentions that it can be found in the ApiDemos, but i can't seem to find it.
推荐答案
好吧,我会回答我的问题。而是采用AlertDialog.Builder基本上,使用它的构造函数创建一个定期对话,并用一个合适的主题,而不是默认的对话主题。
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.
所以,你的code会是这个样子:
So your code would look something like this:
Dialog dialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar);
希望这可以帮助别人。
Hope this helps someone else.
这篇关于Android的无边界对话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!