Android custom Dialog remove black border
There is always a black border on the Interface displayed during custom Dialog. The following describes how to remove the black border using style.
First, define the custom style in values/styles:
@ Drawable/actionbar_item_background
This is the focus. Only after this is added can the black border be removed.
You can also customize a transparent background image to remove the black border!
Code:
static class MsgDialog extends Dialog implementsandroid.view.View.OnClickListener {private String text;public MsgDialog(Context context, String text) {super(context, R.style.MyDialog);this.text = text;}@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.login_dialog);TextView txt = (TextView) findViewById(R.id.login_dialog_txt);txt.setText(text);TextView confirm = (TextView) findViewById(R.id.login_dialog_btn);confirm.setOnClickListener(this);}@Overridepublic void onClick(View v) {MsgDialog.this.dismiss();}}
Xml: