Created
August 15, 2018 09:24
-
-
Save hilfritz/34fa527405eadbca2353a26054ff5285 to your computer and use it in GitHub Desktop.
Android: full screen dialog fragment
This file contains hidden or 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
//https://stackoverflow.com/questions/7189948/full-screen-dialogfragment-in-android | |
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | |
//val dialog = super.onCreateDialog(savedInstanceState) | |
// request a window without the title | |
//dialog.window!!.requestFeature(Window.FEATURE_NO_TITLE) | |
// the content | |
val root = RelativeLayout(activity) | |
root.layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) | |
// creating the fullscreen dialog | |
val dialog = Dialog(activity) | |
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE) | |
dialog.setContentView(root) | |
dialog.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) | |
dialog.window!!.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) | |
return dialog | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment