The first step:
Defining Layout.xml Files
<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:layout_width= "Match_parent"
android:layout_height= "Match_parent"
Android:background= "@android: Color/transparent" //Background transparent
>
Step Two:
Define custom theme styles in the Style.xml file
<!--dialog box style-->
<style name= "Customdialog" parent= "@android: Style/theme.dialog";
<item Name= "Android:windowanimationstyle" > @android: style/animation.dialog</item>
<item name= "Android: Windowsoftinputmode ">STATEUNSPECIFIED|ADJUSTPAN</ITEM>
<item name=" Android:windowbackground "> @android:color/transparent</item>//Set Dialog Background
<item name= android:windowframe > @null </item >//dialog windowframe box is no
<item name= "android:windowisfloating" >true</item>//whether the activity is emerging
<item name= "Android:windowcontentoverlay" > @null </item>
<item name= "Android: Windowistranslucent ">false</item>//is translucent
<item name=" Android:windownotitle ">true</item> Whether to display the title
<item name= "android:backgrounddimenabled" >false</item>//whether the background is blurry
<item name= "Android:windowcloseontouchoutside" >true</item> //Click Background to hide
</style>
Step Three:
Load layout file in activity file
Fourth Step:
Add custom theme Properties when configuring activity in the Mainfest.xml file
<activity android:name= ". Activity. Dialogactivity "
Android:theme= "@style/customdialog"/>
Fifth Step: Set Popup Dialog Content style
WindowManager m = Getwindowmanager ();
Display d = m.getdefaultdisplay (); To get the screen width, height
Windowmanager.layoutparams p = GetWindow (). GetAttributes (); Gets the current parameter value of the dialog box
P.width = (int) (D.getwidth () * 0.95); Width is set to 0.8 of the screen
GetWindow (). SetAttributes (p); Settings take effect
GetWindow (). setgravity (Gravity.bottom); Set the bottom alignment
P.height = (int); Height set to 1.0 of the screen
P.alpha = 1.0f; Set itself transparency
P.dimamount = 0.0f; Set Dark degrees
Dialog for Android custom activity