How to Customize Dialog remove the shadow

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/boatImpish/article/details/76165552

Custom Dialog

Sometimes, there needs to let us customize a dialog box prompts the appropriate information. I encountered a small crater. To others.

Ideas:

Create a custom layout, layout can easily write, then by invoking the AlertDialog.Builer'setView on the object () 将其添加到AlertDialog`.

By default, custom layout will fill the dialog window, but still can be used AlertDialog.Builderto add a button and title method.

Problems encountered

Without content:

  • The reason: There is no where to get the child through the layout file View

Shadow, plus one line of code in the code, provided with a transparent background

  • The reason: with selected topics related to default
    dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);

Guess you like

Origin blog.csdn.net/boatImpish/article/details/76165552