Skip to content

Instantly share code, notes, and snippets.

@Kolyall
Last active November 13, 2019 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kolyall/2d1092bc8ea83ea9827c39ea4e57cf41 to your computer and use it in GitHub Desktop.
Save Kolyall/2d1092bc8ea83ea9827c39ea4e57cf41 to your computer and use it in GitHub Desktop.
Dialogs patterns

Dialogs:

  1. Clear Dialog background
  2. Resize window
new Dialog(getActivity(), R.style.DialogStyle);
<style name="DialogStyle" parent="Base.Theme.AppCompat.Dialog">
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
val window = dialog?.window
window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
window?.clearFlags(FLAG_DIM_BEHIND)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment