This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void showSnackBar (String myString, boolean longTime) { | |
int duration = longTime? Snackbar.LENGTH_LONG : Snackbar.LENGTH_SHORT; | |
Snackbar mySnackbar = Snackbar.make(thePhoto, myString, duration); | |
View myView = mySnackbar.getView(); | |
//use "android.support.design.R.id.snackbar_text" instead of "com.google.android.material" if you are not using Androidx | |
TextView myTextView = (TextView) myView.findViewById(com.google.android.material.R.id.snackbar_text); | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) | |
myTextView.setTextAlignment(View.TEXT_ALIGNMENT_TEXT_START); |