Created
September 22, 2021 19:44
-
-
Save Vnicius/21f1ff358b85696a7729348d06245c04 to your computer and use it in GitHub Desktop.
Example of DialogFragment with fixed width
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
<style name="AlertDialogStyle" parent="Theme.AppCompat.Dialog"> | |
<item name="android:windowIsTranslucent">true</item> | |
<item name="android:windowBackground">@android:color/transparent</item> | |
<item name="android:windowMinWidthMajor">500dp</item> | |
<item name="android:windowMinWidthMinor">90%</item> | |
</style> |
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
open class TransparentBackgroundDialogFragment : DialogFragment() { | |
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | |
setStyle(STYLE_NO_TITLE, R.style.AlertDialogStyle) | |
return super.onCreateDialog(savedInstanceState) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment