Last active
July 25, 2018 15:33
-
-
Save cutiko/348d5dee496d7abfd022d8a2e81ec812 to your computer and use it in GitHub Desktop.
Android Dialogs Cheat Sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*CUSTOM LAYOUT*/ | |
Dialog dialog = new Dialog(context); | |
dialog.setContentView(R.layout.dialog_background_primary_dark); | |
//Then to find a view inside the custom layout use the dialog as root view | |
EditText inputEt = (EditText) dialog.findViewById(R.id.inputEt); | |
/*FULLSCREEN*/ | |
//The style below can be replaced by any fullscreen style, you can create a fullscreen activity and use that style | |
Dialog fullScreen = new Dialog(context, android.R.style.Theme_Black_NoTitleBar_Fullscreen); | |
/*FULLWIDTH*/ | |
Dialog fullWidth = new Dialog(context); | |
fullWidth.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT); | |
/*NO TITLE*/ | |
Dialog dialog = new Dialog(context); | |
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DialogFragment https://gist.github.com/cutiko/7e307efcf7492ea52ef05cd90f9e3203