首页 > 解决方案 > 如何在运行时更改 BottomSheetDialog 的主题

问题描述

我显示 BottomSheetDialog 像:

dialog = BottomSheetDialog(ctx, R.style.DialogTheme)
dialog.setContentView(R.lauout.dialog)
dialog.show()

<style name="DialogTheme" parent="Theme.Design.Light.BottomSheetDialog">
        <item name="android:navigationBarColor">@color/white</item>
    </style>

<style name="DarkDialogTheme" parent="Theme.Design.BottomSheetDialog"/>

我需要在运行时将 DialogTheme 主题更改为 DarkDialogTheme。当对话框被隐藏( dialog.hide() )时,我需要更改主题,但对话框没有被取消。帮我修一下。

标签: androidbottom-sheet

解决方案


推荐阅读