Android custom controls to achieve universal dialog box

Custom controls haven't been updated for some time. Today we bring you a new dialog style to realize richer functions with less code.

Because the dialog box affects the user's operation, there are few dialog boxes on the app at present, but there are still some important information prompts that the style of the dialog box needs to be used, such as version update, account remote login, etc. Let's look at the styles of the Customize dialog box:

Figure 1: Custom prompt dialog box

Figure 2: Custom warning dialog box

Figure 3: default prompt dialog box

Figure 4: default warning dialog box

This brings two dialog box styles, which are also common. All the above background colors, text colors, and button click effects can be customized.

Let's take a look at how the four dialog boxes are implemented, as shown in Figure 1:

Figure 2:

Figure 3:

Figure 4:

Figure 3 and Figure 4 completely use the default color, and I specify the main color of red in the code.

All operations are called by chain, and you can change the color at will according to your app style. Of course, you can also download the code to add richer functions.

The source code is relatively long. Interested children's shoes can be viewed here. The source code adopts the builder mode, which can facilitate chain call and make the code look more concise.

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.

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
分享
二维码
< <上一篇
下一篇>>