Method:
PublicDialog createdialog (context context, view view) {Dialog Mselectphotodialog=NULL; Mselectphotodialog=NewDialog (context, r.style.transparentframewindowstyle); Mselectphotodialog.setcontentview (view); Window Window=Mselectphotodialog.getwindow (); //Setting display animationswindow.setwindowanimations (R.style.select_photo_dialog_animstyle); Windowmanager.layoutparams WL=window.getattributes (); Wl.x= 0; Wl.y=getactivity (). Getwindowmanager (). Getdefaultdisplay (). GetHeight (); //The following sentences are used to ensure that the buttons can be horizontally full screenWl.width =ViewGroup.LayoutParams.MATCH_PARENT; Wl.height=ViewGroup.LayoutParams.WRAP_CONTENT; //Set Display locationmselectphotodialog.onwindowattributeschanged (WL); //set the click Perimeter to dissolveMselectphotodialog.setcanceledontouchoutside (true); Mselectphotodialog.show ();}
Style:
<!--animation effect of the Avatar Pop-up window - <stylename= "Select_photo_dialog_animstyle"> <Itemname= "Android:windowenteranimation">@anim/photo_dialog_in_anim</Item> <Itemname= "Android:windowexitanimation">@anim/photo_dialog_out_anim</Item> </style><!--Avatar Popup Style: Borderless background transparent - <stylename= "Transparentframewindowstyle"Parent= "Android:style/theme.dialog"> <Itemname= "Android:windowbackground">@android: Color/transparent</Item> </style>
Animation: (a), Photo_dialog_in_anim
<?XML version= "1.0" encoding= "Utf-8"?><Setxmlns:android= "Http://schemas.android.com/apk/res/android" > <Translateandroid:duration= "$"Android:fromxdelta= "0"Android:fromydelta= "+"Android:toxdelta= "0"Android:toydelta= "0" /></Set>
(ii), Photo_dialog_out_anim
<?XML version= "1.0" encoding= "Utf-8"?><Setxmlns:android= "Http://schemas.android.com/apk/res/android" > <Translateandroid:duration= "$"Android:fromxdelta= "0"Android:fromydelta= "0"Android:toxdelta= "0"Android:toydelta= "+" /></Set>
Custom dialog, implemented by the bottom of the pop-up effect (imitation QQ exit, etc.)