Set position of a Toast
suggest changeA standard toast notification appears at the bottom of the screen aligned in horizontal centre. You can change this position with the setGravity(int, int, int)
. This accepts three parameters: a Gravity constant, an x-position offset, and a y-position offset.
For example, if you decide that the toast should appear in the top-left corner, you can set the gravity like this:
toast.setGravity(Gravity.TOP|Gravity.LEFT, 0, 0);
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents