BottomSheetDialogFragment为Dark主题设置了错误的背景颜色

and*_*dev 5 android android-theme android-support-library

我最近在我的应用程序中添加了BottomSheetDialogFragment,但它将Material Dark主题的背景颜色显示为白色.即使我使用

android:background="?android:attr/colorBackground"
Run Code Online (Sandbox Code Playgroud)

对于对话框的根布局,它仍然是白色的(但是在对话框之外这个attr是可以的).有没有人遇到过这个问题?

Tam*_*sák 14

底部片对话框的外观是由命名的属性来控制bottomSheetDialogTheme,其缺省值为 Theme.Design.Light.BottomSheetDialog.要获得深色背景(以及白色文本,正确颜色的控件等),您需要在活动主题中覆盖它:

<style name="YourActivityTheme" parent="...">
    <!-- ... -->

    <item name="bottomSheetDialogTheme">@style/Theme.Design.BottomSheetDialog</item>
</style>
Run Code Online (Sandbox Code Playgroud)