设立Toast显示的位置

设置Toast显示的位置可以使用如下方法设置 Toast 显示的位置?public void?setGravity?(int gravity, int x

设置Toast显示的位置

可以使用如下方法设置 Toast 显示的位置

?

public void?setGravity?(int gravity, int xOffset, int yOffset)Since:?API Level 1

Set the location at which the notification should appear on the screen.

?

默认的 Gravity 是

 int mGravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
显示在屏幕的下方,水平居中。