Dialog 사이즈 변경

나고수·2022년 5월 6일
0

1일1공부

목록 보기
34/68
post-custom-banner

Dialog size 변경

//parent="Theme.MaterialComponents.Light.Dialog.Alert" 👈앱Theme에 맞는거 설정 . alertDialog
 <style name="MyAlertDialogStyle" parent="Theme.Design.Light.BottomSheetDialog"> 👈앱Theme에 맞는거 설정 . bottomSheetDialog
        <item name="android:windowMinWidthMajor">80%</item> 👈 width 설정
        <item name="android:windowMinWidthMinor">80%</item> 👈 width 설정
        <item name="android:minHeight">180dp</item> 👈 height 설정
        <item name="windowNoTitle">true</item>
        <item name="android:windowBackground">@drawable/bg_white_4</item>
        <item name="android:windowIsFloating">true</item>
    </style>
  • alertDialog
val alertDialog = AlertDialog.Builder(context, R.style.MyAlertDialogStyle)
    .setView(binding.root)
    .create()
  • bottomSheetDialog
   override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setStyle(DialogFragment.STYLE_NO_TITLE, R.style.MyAlertDialogStyle)
    }
profile
되고싶다
post-custom-banner

0개의 댓글