Android dialog box custom title beautification operation

The dialog box title provided by Android is not good-looking. If we need to set a self-defined title for the pop-up dialog box, we can use alertdialog The setcustomtitle() method of builder.

Define the title of a dialog box title XML file:

Layout file for mainactivity:

MainActivity. Java file:

The operation effect is as follows. Click the first button on the left to pop up the dialog box provided by Android system (set the title directly with settitle()); On the right is to click the second button, first inflate a view, and then use the setcustomtitle () method to set the view as the title of 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.

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