What is the value of Toast.LENGTH_LONG and Toast.LENGTH_SHORT?

为君一笑 提交于 2019-12-21 03:12:07

问题


I am printing Toast message in my application to show notification but i want to know value of Toast.LENGTH_LONG and Toast.LENGTH_SHORT. What other values i can use.

Can anyone tell me what is the value of these two variables?


回答1:


There is another question that answers what you are looking for. The answers are:

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

This was courtesy of FeelGood. You can find the whole thread below.

Can an Android Toast be longer than Toast.LENGTH_LONG?

Hope this helps.




回答2:


There are only these two constants related to Toast

http://developer.android.com/reference/android/widget/Toast.html#LENGTH_LONG

Why would you want to know their values though? You should always use the constants instead.




回答3:


They are one and zero as detailed in the Toast documentation. They are the only two values and no others are possible. There is an "indefinite toast hack", but I would not use an application that used it.



来源:https://stackoverflow.com/questions/6989583/what-is-the-value-of-toast-length-long-and-toast-length-short

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!