Simple Android toasts not aligning properly

I managed to fix it. The problem lies in applying the attribute android:fitsSystemWindows to the theme of an activity. I found this answer that explains why that should not be done:

The android:fitsSystemWindows attribute is intended for usage on views in layout xml, not in themes.

What you're seeing is the effect of the way the styled attribute system works in Android. If no attribute is specified on the view element or in the explicit style given to the view, the framework checks to see if that attribute has been specified on the theme itself. If it is found there, that value is used. Since the views used by toasts use your activity's theme, the default value of false is overridden and you see this behavior.

You're not just changing the fitsSystemWindows default for your top-level views by specifying it in the theme, you're overriding it for all views with that theme, which isn't what you want. You should only specify fitsSystemWindows on views within your layouts or in styles that you explicitly apply to views within your layouts, not on themes.

Just apply the attribute to the topmost ViewGroup of the activity (or style it) instead of its theme and the toast will be formatted correctly.