Android system dialog box usage details (most detailed)

In practical application development, there is almost no use in the system dialog box. According to the development process, UI engineers will give the style of each pop-up window, so they customize the pop-up window in actual development.

That is, there are not many places to use, but we also need to understand and skillfully use it. Here are the implementations of various system dialog boxes.

catalogue

1、 Several types and implementation of system dialog box

In the actual development of the project, there are almost no system dialog boxes. The reasons include the following:

The style is too single to meet the needs of most actual projects.

The style of the dialog box will vary according to the version of the mobile phone system. Can not achieve a unified style.

The functions that can be realized are too simple.

Attach the string. XML file with the text in the following code.

1. General dialog

In actual project development, this type of dialog box is used more than other types of dialog boxes. However, considering the issue of UI unification, it will rarely be used.

Operation screenshot:

code:

The system dialog box supports chain calling, for example:

The following code can be called in a chain, which will not be shown here.

2. Normal dialog box (multi button)

There are up to three buttons in the system dialog box, namely, positive button, negative button and neutral button.

Operation screenshot:

code:

You can also use the following implementation method, which has the same effect as the above code.

3. General list dialog box

This type of dialog box can realize simple list.

Operation screenshot:

code:

4. Radio dialog box

Operation screenshot:

code:

5. Multi selection dialog box

Operation screenshot:

code:

6. Pop up window with input box

Operation screenshot:

code:

7. Custom layout dialog box

This type of dialog box is used more in the actual project development than the prompt dialog box, but it is almost a custom dialog box in the project

Operation screenshot:

Layout files: Custom_ dialog_ layout.xml

code:

The above are several ways to realize the pop-up window of Android system, almost covering all kinds of simple requirements. The way of custom layout lays the foundation for the basic implementation of custom pop-up window.

2、 Summary

It can be seen that the above implementation methods are implemented through the alertdialog class. If you are interested, you can see the implementation of the alertdialog class in the Android source code.

The above is a detailed explanation of the Android system dialog box introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>