2012-09-13 27 views
4

我需要删除对话框中的标题。注意:我不需要一个空白title.I需要删除标题section.Following是我的代码:无标题对话框

final Dialog dialog1=new Dialog(context); 
    dialog1.setContentView(R.layout.redeemvoucher_first); 
    dialog1.setCanceledOnTouchOutside(true); 
    dialog1.getWindow().setLayout(900,500); 
     dialog1.show(); 

回答

6

试试这个在创建对话框

dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 
3

调用setContentView之前,添加此删除标题:

dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 
+0

+1多为提调用的setContentView之前。 – Joyson

+0

一定要接受答案,如果它满足您的需求,以便其他人可以从中受益。 – MCeley

1

尝试更换:

Dialog dialog1=new Dialog(context) 

有:

Dialog dialog1=new Dialog(context, android.R.style.Theme_NoTitleBar);