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 usedAlertDialog.Builder
to 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);