Android的 - 全部隐藏显示吐司消息 [英] Android - Hide all showed Toast Messages
本文介绍了Android的 - 全部隐藏显示吐司消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个问题,我怎么禁止所有敬酒的消息是目前进程?
I have a problem, how do I disable all toast messages being process currently?
在我的应用程序,有一个列表中,当用户点击一个项目,显示敬酒消息, 10个项目 - 10吐司消息,
In my App, there is a list, when a user clicks on an item, a toast message is being displayed, 10 items - 10 toast messages,
因此,如果用户点击了10次,那么presses菜单按钮......他要等待几秒钟,直到他能看懂菜单选项的文本。
so if the user clicks 10 times, then presses the menu button... he has to wait for some seconds, until he's able to read the menu option text.
不应该是这样的:)
推荐答案
我的解决办法是初始化活动单一吐司。然后在每一次点击改变其文本。
My solution was to initialize a single Toast in the activity. Then changing its text on each click.
Toast mToast = Toast.makeText(this, "", Toast.LENGTH_SHORT);
if (a) {
mToast.setText("This is a");
mToast.show();
} else if (b) {
mToast.setText("This is b");
mToast.show();
}
这篇关于Android的 - 全部隐藏显示吐司消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文