Toast LENGTH_LONG 和 LENGTH_SHORT 的持续时间是多少 [英] What is the duration of a Toast LENGTH_LONG and LENGTH_SHORT

查看:31
本文介绍了Toast LENGTH_LONG 和 LENGTH_SHORT 的持续时间是多少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要以毫秒 (ms) 为单位的 LENGTH_LONG 和 LENGTH_SHORT 的确切持续时间.此外,我需要知道 LENGTH_LONG 的 Toast 消息的持续时间在任何手机和任何 API 版本中是否具有相同的持续时间.

I need the exact duration of LENGTH_LONG and LENGTH_SHORT in milliseconds (ms). Also I need to know if the duration of Toast message with LENGTH_LONG will have the same duration in any phone and with any API version.

有人知道持续时间在哪里定义吗?我的意思是在 ms 中定义.我知道 LENGTH_LONG 是一些值为 1 的 int const.但我找不到定义的实际持续时间在哪里.

Does someone know where is the duration defined ?, I mean defined in ms . I know that LENGTH_LONG is some int const with value 1. But I could not find where is the actual duration defined.

推荐答案

已在此处回答.就像你提到的 Toast.LENGTH_SHORTToast.LENGTH_LONG 不是以毫秒为单位,而是以 0 或 1 为单位.

Answered here. Like you mentioned Toast.LENGTH_SHORT and Toast.LENGTH_LONG are not in ms but 0 or 1.

实际持续时间为:

private static final int LONG_DELAY = 3500; // 3.5 seconds
private static final int SHORT_DELAY = 2000; // 2 seconds

这篇关于Toast LENGTH_LONG 和 LENGTH_SHORT 的持续时间是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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