Skip to content

Instantly share code, notes, and snippets.

@akshaykalola28
Created March 2, 2023 06:13
Show Gist options
  • Save akshaykalola28/0aa60dd8355ce107c9c49e7281cbf096 to your computer and use it in GitHub Desktop.
Save akshaykalola28/0aa60dd8355ce107c9c49e7281cbf096 to your computer and use it in GitHub Desktop.
Kotlin extenstion for snackbar visibility for android view
import android.view.View
import androidx.annotation.StringRes
import com.google.android.material.snackbar.Snackbar
fun View.snackbar(message: String, duration: Int = Snackbar.LENGTH_LONG) {
Snackbar.make(this, message, duration).show()
}
fun View.snackbar(@StringRes message: Int, duration: Int = Snackbar.LENGTH_LONG) {
Snackbar.make(this, message, duration).show()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment