我要显示敬酒不到Toast.LENGTH_SHORT,因为我觉得它走大约2秒。我想只为半秒显示敬酒。
I want to display toast less than Toast.LENGTH_SHORT, as i feel its taking around 2 seconds. i want to display toast only for half second.
什么是Toast.LENGTH_SHORT和Toast.LENGTH_LONG时间间隔?
And what is time interval for Toast.LENGTH_SHORT and Toast.LENGTH_LONG ?
有只有两个可能的值:
private static final int LONG_DELAY = 3500; // 3.5 seconds
private static final int SHORT_DELAY = 2000; // 2 seconds
设置其他值不起作用。如果持续时间不等于1( Toast.LENGTH_LONG
),那么持续时间将SHORT_DELAY(2秒):
Setting other values doesn't work. If duration not equals 1 (Toast.LENGTH_LONG
), then duration will be SHORT_DELAY (2 seconds):
long delay = immediate ? 0 : (r.duration == Toast.LENGTH_LONG ? LONG_DELAY : SHORT_DELAY);
在吐司
来源写了
这一次可能是用户自定义的。
This time could be user-definable.
但我不能找到办法做到这一点。
but I can't find way to do this.
更新:有解决方案在这里:设置吐司出现长度
Update: There is solution here: Set Toast Appear Length