Android customization dialog
This article briefly introduces the use of the custom dialog box. The code and structure are very simple. The purpose is to quickly use the custom dialog box. This article does not specifically explain the advanced use of the dialog box.
Implementation steps
First, we need to build our own layout in our. XML file. After the layout file is completed, we can define the layout style under the style file. After the first two steps are completed, I start writing java files
Specific implementation process
1. XML file
The above is my XML code, which uses some simple components. You can make it according to your own needs and style. Some components use the style attribute, which we also build in the RES / value / style file. Note: the initials of all components should be capitalized.
2. style
3. Class file
This class inherits dialog. In this class, we need to have a constructor that references our style file. The next step is our general routine. In particular, I use dismiss () in this class; To destroy the dialog box. In mainactivity. Java, you only need to instantiate this class, create an object, and call show () of the object; Method to display the dialog box.
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.