16
如何更改小吃店的背景颜色?
我在alertDialog的正面单击中的DialogFragment中显示小吃栏。这是我的代码段。 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(); 我正在将dialogfragment的视图传递给小吃店。我想要背景颜色黑色吗?我怎样才能做到这一点?我在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> 尽管我将对话框的背景色设置为白色,但应通过将背景色设置为小吃栏来覆盖它。