我在DialogFragment中显示snackbar在alertDialog的正面点击中.这是我的代码片段.
Snackbar snackbar = Snackbar.make(view, "Please enter customer name", Snackbar.LENGTH_LONG)
.setAction("Action", null);
View sbView = snackbar.getView();
sbView.setBackgroundColor(Color.BLACK);
snackbar.show();
Run Code Online (Sandbox Code Playgroud)
我正在将对话片段的视图传递给快餐栏.我想要背景颜色为黑色?我怎样才能做到这一点?我在DialogFragment中返回alertDialog.我正在设置对话框的主题如下
<style name="MyAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<!-- Used for the buttons -->
<item name="colorAccent">@color/accent</item>
<!-- Used for the title and text -->
<item name="android:textColorPrimary">@color/primary</item>
<!-- Used for the background -->
<item name="android:background">@color/white</item>
</style>
Run Code Online (Sandbox Code Playgroud)
虽然我将背景颜色设置为白色以进行对话,但是应该通过将背景颜色设置为快餐栏来覆盖它.
android android-dialogfragment material-design android-snackbar