Skip to content

Instantly share code, notes, and snippets.

@hilfritz
Created August 15, 2018 09:24
Show Gist options
  • Save hilfritz/34fa527405eadbca2353a26054ff5285 to your computer and use it in GitHub Desktop.
Save hilfritz/34fa527405eadbca2353a26054ff5285 to your computer and use it in GitHub Desktop.
Android: full screen dialog fragment
//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