简体   繁体   中英

Is there a way to remove/transparent background color of a snackbar in android?

Can anyone guide me how to make background of a snackbar transparent?

Thanks

Snackbar snackbar = Snackbar.make(mainView, text, Snackbar.LENGTH_LONG);
View snackBarView = snackbar.getView();
snackBarView.setBackgroundColor(context.getResources().getColor(R.color.yourcolor));
snackbar.show();

you can define your color as transparent in values.

For newcomers (Kotlin)

snackbar.view.setBackgroundColor(Color.TRANSPARENT)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM