I am trying to get the TextView
of the Snackbar
with this code snippet:
snackbarView.findViewById<TextView>(android.support.design.R.id.snackbar_text)
but Android Studio does not resolve the design library.
How can I get this code to work?
I am trying to get the TextView
of the Snackbar
with this code snippet:
snackbarView.findViewById<TextView>(android.support.design.R.id.snackbar_text)
but Android Studio does not resolve the design library.
How can I get this code to work?
Solved with this solution: snackbarView.findViewById<TextView>(com.google.android.material.R.id.snackbar_text)
Changing this :
android.support.design.R
with
com.google.android.material.R
solves the problem . After Migration to AndroidX we are working with different library.
You've migrated to AndroidX, which means the library is different now.
(android.support.design.R.id.snackbar_text) to (com.google.android.material.R.id.snackbar_text)
As android.support.design.R is no more supported after androidx migration, So you need to replace it
with
com.google.android.material.R