Method of customizing background and width and height of dialogfragment in Android

introduce

Dialogfragment was introduced in Android 3.0. Is a special fragment used to display a modal dialog box on the content of the activity. Typical: display warning box, input box, confirmation box, etc.

Before dialogfragment is generated, we create dialog boxes: alertdialog and dialog are generally used. Note: the official does not recommend directly using dialog to create dialog boxes.

This article mainly introduces the related contents about the customized background and width and height of dialogfragment in Android, which can be shared for your reference and learning. I won't say much below. Let's take a look at the detailed introduction together.

The customization method is as follows:

Apply first without title block

Then specify the width and height again in the OnStart method

First set the transparent background, and then set the width and height through displaymetrics.

summary

The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. If you have any questions, you can leave a message. Thank you for your support for 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
分享
二维码
< <上一篇
下一篇>>