[Android interface] how to remove the black background and border DEMO of dialog
The default dialog box of the android system is a black background and a white border style. It is quite beautiful for the android system, but it is different from your own project style, so I had to try to rewrite his style. Of course, dialog supports style rewriting.
Use new Dialog (context, style). setContentView (layout );
You can customize the dialog of your project.
Of course, the style here plays a crucial role. You need to know that the white edge that is not compatible with the project depends on it.
Create style. xml under value
Here is my code:
First: MainActivity
protected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);setContentView(R.layout.main);} public void dialogStyle(View v){ final Dialog d=new Dialog(this, R.style.dialog); View vv = LayoutInflater.from(this).inflate(R.layout.dialog_test, null); TextView delete = (TextView) vv.findViewById(R.id.delete); d.setCanceledOnTouchOutside(true); d.setContentView(vv); d.show(); delete.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View arg0) {// TODO Auto-generated method stubd.dismiss();}}); }}
Then: style
Last xml
Source Code address: http://download.csdn.net/detail/u014608640/8046705 has a need of friends can download