public class ToastUtil {
private static final String TAG = ToastUtil.class.getSimpleName();
private ToastUtil() {}
private static Toast mToast = null;
public static final void showToast(Context context, String content) {
LayoutInflater inflater =
(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.toast, null);
TextView textview = (TextView) view.findViewById(R.id.toast_content);
if (!TextUtils.isEmpty(content)) {
textview.setText(content);
}
if (mToast == null) {
mToast = new Toast(context);
mToast.setGravity(Gravity.FILL_HORIZONTAL | Gravity.TOP, 0, 0);
mToast.setDuration(Toast.LENGTH_SHORT);
}
mToast.setView(view);
mToast.show();
}
}
设置这句
mToast.setGravity(Gravity.FILL_HORIZONTAL | Gravity.TOP, 0, 0);
就可以全屏了。