android--Custom Dialog

Source: Internet
Author: User

  1. To create an dialog instance:

    Dialog Dialog = new Dialog (Context context,int theme);

    Generally everyone wants to let dialog show their layout here's theme written in the style file as follows:

  2. <style name= "Dialog_tran"  parent= "Android:style/theme.dialog" >         <item name= "Android:windowframe" > @null </item>         <item name= "Android:windownotitle" >true</item>         <item name= "Android:windowbackground" > @android: Color/transparent</item >        <item name= "Android:windowisfloating" >true</ Item>        <item name= "Android:windowContentOverlay" >@ Null</item>        <item name= "Android: Windowistranslucent ">true</item>        <item name=" Android:backgrounddimenabled ">false</item>        <item  name= "Android:backgrounddimamount">0.4</item>    </style>    <style name= "Dialog_ Untran " parent=" Dialog_tran ">        <item name=" Android:backgrounddimenabled ">true</item>    </style>

3.setContentView ():

(1) setcontentview (int layoutid): If you use this method, you can set the size of the outermost layout in the XML layout file so that the size of the dialog display is the size set in the layout file;

(2) Setcontentview (view view): In this way, regardless of the layout file in the outermost layout file of the width of the full screen display, at this time we can be the layout file sub-layer layout as we want to show the layout to achieve the effect;

4. Animating the view in 3 is an animated effect for dialog.

android--Custom Dialog

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.