If I set the background color of my Toast
with
t.getView().setBackgroundColor(
ctx.getResources().getColor(R.co
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);
There is no way to prevent that. The default background for the toast is a drawable that defines the rounded corners. If you want rounded corners in a different color, you'll have to define your own shape drawable.