Android Toast可以长于Toast.LENGTH_LONG吗? [英] Can an Android Toast be longer than Toast.LENGTH_LONG?
问题描述
将setDuration()用于Toast时,是否可以设置自定义长度或至少长于Toast.LENGTH_LONG
的长度?
When using setDuration() for a Toast, is it possible to set a custom length or at least something longer than Toast.LENGTH_LONG
?
推荐答案
LENGTH_LONG
是0和1.这意味着它们被视为标志而不是实际持续时间,因此我认为不可能将持续时间设置为这些值以外的任何值.
The values of LENGTH_SHORT
and LENGTH_LONG
are 0 and 1. This means they are treated as flags rather than actual durations so I don't think it will be possible to set the duration to anything other than these values.
如果您想向用户显示消息的时间更长,请考虑使用状态栏通知.当状态栏通知不再相关时,可以通过编程方式取消它们.
If you want to display a message to the user for longer, consider a Status Bar Notification. Status Bar Notifications can be programmatically canceled when they are no longer relevant.
这篇关于Android Toast可以长于Toast.LENGTH_LONG吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!