Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. Toast toast = Toast.makeText(this, content, Toast.LENGTH_SHORT);
  2. toastView.findViewById(android.R.id.message);
  3. View toastView = toast.getView();
  4. Drawable toastBg = toastView.getBackground();
  5. Drawable drawable = tintDrawable(toastBg, ColorStateList.valueOf(Color.RED));
  6. toastView.setBackground(drawable);
  7. toast.setView(toastView);
  8. toast.show();
  9.  
  10. public Drawable tintDrawable(Drawable drawable, ColorStateList colors) {
  11. final Drawable wrappedDrawable = DrawableCompat.wrap(drawable);
  12. DrawableCompat.setTintList(wrappedDrawable, colors);
  13. return wrappedDrawable;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement