When using setDuration() for a Toast, is it possible to set a custom length or at least something longer than Toast.LENGTH_LONG
?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Sets toast to a specific period in milli-seconds:
Schedule a countdown until a time in the future, with regular notifications on intervals along the way. Example of showing a 30 second countdown in a text field:
After failing with every available solution, I finally had workaround using recursion.
Code:
I have developed a Custom Toast class with which you can show Toast for a desired amount of duration (in Milli seconds)
You may want to try:
to double the time. If you specify 3 instead the 2 it will triple the time..etc.
Use Crouton, it is a very flexible Toast library.
Crouton
You can use it just like toasts:
or you can even go a little deeper and customise it more, like setting the time to infinite! for example here I want to show a toast message until the user acknowledges it by clicking on it.
Custome Layout that will be inflated for the toast.