android ToastShow 直接切换文字,不闪烁

1、代码

   

public class ToastUtils {
    private static Toast mToast;
    
    public static void showToast(Context context,CharSequence text,int duration){
    if (mToast==null) {
mToast=Toast.makeText(context, text, duration);
}else {
mToast.setText(text);
mToast.setDuration(duration);
}
    mToast.show();
    }
}


posted @ 2016-03-04 14:54  云中鹤5786  阅读(362)  评论(0编辑  收藏  举报