The example of this article describes the Android custom dialog simple implementation method. Share to everyone for your reference, specific as follows:
@Override
protected void onCreate (Bundle savedinstancestate) {
super.oncreate (savedinstancestate);
Setcontentview (r.layout.function_music);
Instantiates the new window windows
w = GetWindow ();
Get the default display data show display
= W.getwindowmanager (). Getdefaultdisplay ();
Get a background picture of a window resources
= Musicactivity.getresources ();
drawable drawable = resources.getdrawable (R.DRAWABLE.OPERATE_BG);
Set the background picture of the window
w.setbackgrounddrawable (drawable);
The title of the window is empty
w.settitle (null);
Defines a window's width and height
int width = (int) (Display.getwidth () * 0.8);
int height = (int) (Display.getheight () * 0.5);
Set the size of the window
w.setlayout (width, height);
Sets the display position of the window
w.setgravity (gravity.center);
Set the properties of the window
windowmanager.layoutparams wl = W.getattributes ();
W.setattributes (WL);
Gets the control
Findview ();
}
For more information about Android development interested readers can view the site topics: "Android Development Introduction and Advanced Tutorial"
I hope this article will help you with the Android program.