Toast工具,强大的吐司,能够连续弹的吐司。

来源:互联网 发布:海岛大亨5知乎 编辑:程序博客网 时间:2024/04/29 21:35
package com.itheima.googleplay.util;import android.widget.Toast;import com.itheima.googleplay.global.GooglePlayApp;public class ToastUtil {private static Toast toast;/** * 强大的吐司,能够连续弹的吐司 * @param text */public static void showToast(String text){if(toast==null){toast = Toast.makeText(GooglePlayApp.context, text,0);}else {toast.setText(text);//如果不为空,则直接改变当前toast的文本}toast.show();}}

0 0