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:
<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