[Android interface] how to remove the black background and border DEMO of dialog

Source: Internet
Author: User

[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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.