SoFunction
Updated on 2025-04-09

Simple implementation method for custom dialog for Android

This article describes the simple implementation method of custom dialog on Android. Share it for your reference, as follows:

@Override
 protected void onCreate(Bundle savedInstanceState) {
 (savedInstanceState);
 setContentView(.function_music);
 // Instantiate a new window Window w = getWindow();
 // Get the default displayed data Display display = ().getDefaultDisplay();
 // Get the background image of the window Resources resources = ();
 Drawable drawable = (.operate_bg);
 // Set the background picture of the window (drawable);
 // The title of the window is empty (null);
 // Define the width and height of the window int width = (int) (() * 0.8);
 int height = (int) (() * 0.5);
 // Set the window size (width, height);
 // Set the display position of the window ();
 // Set the properties of the window  wl = ();
 (wl);
 // Get the control findView();
}

For more information about Android development, readers who are interested in reading the topic of this site:Android development introduction and advanced tutorial

I hope this article will be helpful to everyone's Android programming design.