能在Android吐司长于" Toast.LENGTH_LONG"?吐司、能在、Android、LENGTH_LONG

2023-09-12 00:05:44 作者:哥丿依然低调

当使用setDuration的吐司是可以设置自定义的长度至少比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_SHORT和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 cancelled when they are no longer relevant.