I have a snackbar but when switching activity's it stays on the original activity it had been activated. Is there a way to make it stay on screen when switching activity's?
val mainSnackBar = Snackbar.make(findViewById(android.R.id.content), "", Snackbar.LENGTH_SHORT)
val llp = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)
llp.topMargin = 20
llp.bottomMargin = 20
This is the code when clicking on a button to switch activity's:
mainSnackBar.apply {
setActionTextColor(Color.BLACK)
view.setBackgroundColor(resources.getColor(R.color.good_color))
setText("Snackbar Message")
val snackTextView = view.findViewById(com.google.android.material.R.id.snackbar_text) as TextView
snackTextView.textSize = 17f
snackTextView.layoutParams = llp
snackTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_check, 0, 0, 0)
}.show()