Android dialog Way to black-side _android

Source: Internet
Author: User

This example shows a dialog approach to black edges in Android. And it is divided into two kinds of methods: preserving shadow and not preserving shadow. For reference. The implementation methods are as follows:

1. Do not preserve shadows

The code is as follows:

<?xml version= "1.0" encoding= "Utf-8"?> <resources> <style name= "dialog" parent= "  
  @android: Style/theme.dialog "><!--name is the hallmark of the resources we use when using, and parent refers to the-->  
     <item name=" Android, which inherits the current style. Windowframe "> @null </item>  
    <item name=" android:windowisfloating ">true</item>  
    < Item Name= "Android:windowistranslucent" >false</item>  
    <item name= "Android:windownotitle" >true </item><!--Hide title bar-->  
    <item name= "Android:background" > @color/clarity</item>  
    < Item Name= "Android:windowbackground" > @drawable/clarity</item>< It's important here, too, I've used a transparent. 9.png diagram, of course. 00000000 is also possible, otherwise the word here comes out with a black background-->  
    <item name= "android:backgrounddimenabled" >false</item>  
  </style>  
</resources>  

2. Preserve Shadows

The code is as follows:

<resources>
  <style name= "dialog" parent= "@android: Style/theme.dialog" > 
    <item name= "Android : Windowframe "> @null </item> 
    <item name=" Android:windownotitle ">true</item> 
    <item Name= "Android:windowbackground" > @null </item> 
  </style> 
</resources> 
Final Dialog Dialog = new Dialog (context, r.style.dialog); 
Dialog.setcontentview (view); 
Dialog.show ();

I hope the code described in this article will help you with your Android program.

Related Article

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.