Tôi đang hiển thị snackbar trong DialogFragment Trong tích cực click của alertDialog. Đây là đoạn mã của tôi.Làm cách nào để thay đổi màu nền của thanh snack?
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();
tôi đi qua điểm của dialogfragment đến snackbar. Tôi muốn màu nền đen? Tôi có thể làm cái này như thế nào? Tôi đang trả về alertDialog trong DialogFragment. Và chủ đề tôi đang đặt cho hộp thoại như sau là
<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>
Mặc dù tôi đặt màu nền thành trắng cho hộp thoại, nó sẽ ghi đè bằng cách đặt màu nền cho thanh snack.
[http://www.technotalkative.com/part-3-styling-snackbar/](http://www.technotalkative.com/part-3-styling-snackbar/) –
cố gắng đó đã không giúp tôi ... tôi đang gọi thanh snack từ đoạn hộp thoại + alertDialog trong đó và tôi đang chuyển sang chế độ xem nút bấm tích cực cho thanh snack – Ajinkya