2012-11-28 11 views
0

如何摆脱android中的对话框中恼人的标题?如何在android中的对话框中摆脱烦人的标题

这就像我读出对话框:

data myDialog = new data(context); 
myDialog.show(); 

这是我的对话框

public class data extends Dialog { 
    public data(Context context) { 
     super(context); 
    } 
    TextView txtName; 

    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.data); 
     setTitle("annoying title"); 
     Button btnClose; 
     Button btnexit; 

     txtName = (TextView)findViewById(R.id.txtName); 
     txtName.setText(MyParam.Fname_Lname); 
     //txtName.setText(MyParam.zPhone); 


     btnClose = (Button) findViewById(R.id.btnDiel); 
     btnClose.setOnClickListener(new Close()); 

     btnexit = (Button) findViewById(R.id.btnSMS); 
     btnexit.setOnClickListener(new exit()); 
    } 

    private class Close implements android.view.View.OnClickListener { 
     public void onClick(View v) { 
      data.this.dismiss(); 
     } 
    } 

    private class exit implements android.view.View.OnClickListener { 
     public void onClick(View v) { 
      data.this.dismiss(); 
     } 
    } 

我尝试删除此行setTitle("annoying title");

我试试这个

myDialog.getWindow(); 
myDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 

,但如果我这样做,我看到我的垂直线

+1

只要删除该行! –

回答

0

我不知道你在哪里声明的类型的数据,但如果你调用对话框构造那样做:

new Dialog(getContext(),android.R.style.Theme_Translucent_NoTitleBar);