If I set the background color of my Toast
with
t.getView().setBackgroundColor(
ctx.getResources().getColor(R.color.myorange));
the new (Android 4.4) rounded Toast becomes rectangular. Any way to prevent this apart from using a custom rounded background Drawable
?
If you need to change the background of the Toast then you need to use getView(). setBackground() function. If You need to change the color of the view created then you need to use getView(). getBackground().
Use a small paint brush and dip the brush into the food coloring. Then take a piece of bread and paint a face or picture of choice on it. Place the bread into a toaster and wait till the bread is lightly toasted. Butter lightly to give taste.
Do not try to set the background color directly, set a color filter instead. That will preserve the toast shape:
int backgroundColor = ResourcesCompat.getColor(t.getView().getResources(), R.color.myorange, null);
t.getView().getBackground().setColorFilter(backgroundColor, PorterDuff.Mode.SRC_IN);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With