我可以取消previous敬酒时,我想表现出其他的面包? [英] Can I cancel previous Toast when i want to show an other Toast?

查看:176
本文介绍了我可以取消previous敬酒时,我想表现出其他的面包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序,我建立一个日历组件为我actvity,当我滚动到previous或下个月,我让它做一个面包和表现出来。

现在的问题是,敬酒需要时间来证明,当我把它的滚动速度不够快,例如,我滚动到2012/05和2012/06,并滚动到2012/07没有停顿,我要等2012/05,2012/06,2012/07敬酒以示逐一缓慢。

看起来像Android有一个看不见的队列管理祝酒词

我怎么能清洁并只显示最后一个土司?我可以马上显示出specificate吐司,而无需等待?

我搜索了android.widget.Toast.java,找到一个方法取消(),但遗憾的是它剂量不作为后续工作。

 如果(T!= NULL){
    t.cancel();
}
T = Toast.makeText(this.mContext,mHelper.getYear()+年
                +(mHelper.getMonth()+ 1)+月,Toast.LENGTH_SHORT);
t.show();
 

解决方案

您不能这样做,因为你必须创建自己的自定义查看看起来像吐司

  .hide()
。取消()
 

以上方法也有,但他们不似乎工作。

In my app,I construct a calendar widget for my actvity, when I scroll it to previous or next month,I let it make a toast and show it.

The question is, the toast need time to show, when I scroll it fast enough, for example, I scrolled to "2012/05" and "2012/06"and scroll to "2012/07" without pause, I have to wait the Toast of "2012/05", "2012/06","2012/07" to show one by one slowly.

Seems like android has a invisible queue to manage toasts

how can I clean it and only show the last toast?Can I show a specificate Toast immediately without waiting?

I searched the "android.widget.Toast.java" and find a method "cancel()",but unfortunately it dose not work as follow.

if (t != null) {
    t.cancel();
}
t = Toast.makeText(this.mContext, mHelper.getYear() + "年"
                + (mHelper.getMonth() + 1) + "月", Toast.LENGTH_SHORT);
t.show();

解决方案

You can't do that, for that you have to create your own custom View which looks like Toast.

.hide()
.cancel()

above methods are available but they dont seems to be work.

这篇关于我可以取消previous敬酒时,我想表现出其他的面包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆