dovar66 / dtoast Goto Github PK
View Code? Open in Web Editor NEW同学,你的系统Toast可能需要修复一下!Fix Your Android Toast!
同学,你的系统Toast可能需要修复一下!Fix Your Android Toast!
// toast距离底部边距的dimenId
int yOffsetId = Resources.getSystem().getIdentifier("toast_y_offset", "dimen", "android");
// toast默认布局
int layoutId = Resources.getSystem().getIdentifier("transient_notification", "layout", "android");
华为荣耀8青春版
Android版本:8.0.0
EMUI版本:8.0.0
android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
如题
有jcenter的地址吗,这样后续升级就不用重复下载代码了
手机Android版本25,
app targetsdk 28
关闭权限后,两种方式均不可正常弹出
UIUtils.showToast(this, "请填写手机号"); 不可以弹出
UIUtils.showToast(CSApp.getApplication(), "请填写手机号"); 不可以弹出
vivo手机上不会弹出toast哦
努比亚8.1系统,关闭通知权限DToast不显示
显示AlertDialog情况下,再点击dialog内容弹出Toast,吐司视图在dialog下方
Without any license, according to Github default license policy, no one is allowed to use this code.
https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository
You're under no obligation to choose a license. However, without a license, the default copyright laws apply, meaning that you retain all rights to your source code and no one may reproduce, distribute, or create derivative works from your work. If you're creating an open source project, we strongly encourage you to include an open source license. The Open Source Guide provides additional guidance on choosing the correct license for your project.
W: Accessing hidden field Landroid/widget/Toast;->mTN:Landroid/widget/Toast$TN; (greylist-max-p, reflection, denied) W: java.lang.NoSuchFieldException: No field mTN in class Landroid/widget/Toast; (declaration of 'android.widget.Toast' appears in /system/framework/framework.jar!classes3.dex) W: at java.lang.Class.getDeclaredField(Native Method) W: at com.dovar.dtoast.inner.SystemToast.getField(SystemToast.java:235) W: at com.dovar.dtoast.inner.SystemToast.setupToastAnim(SystemToast.java:215) W: at com.dovar.dtoast.inner.SystemToast.showInternal(SystemToast.java:82) W: at com.dovar.dtoast.inner.SystemTN.displayToast(SystemTN.java:131) W: at com.dovar.dtoast.inner.SystemTN.showNextToast(SystemTN.java:111) W: at com.dovar.dtoast.inner.SystemTN.notifyNewToastComeIn(SystemTN.java:71) W: at com.dovar.dtoast.inner.SystemTN.add(SystemTN.java:40) W: at com.dovar.dtoast.inner.SystemToast.show(SystemToast.java:52)
怎么设置点击事件及自定义大小
建议升级个版本,切换到Android x架构
vivo X9手机上在 .show()方法很慢,需要约2秒后才能显示。android7.1
场景:较频繁地弹 DToast 的情况
步骤:第一步自行弹出一个系统的 Toast,然后马上一直频繁弹 DToast
结果:DToast 一直弹不出来,如果接下来控制一下停止弹 DToast,过会再继续弹,那么现在就能够弹出【换句话说,如果有个需求是频繁弹 DToast 的情况是紧接着一个系统的 Toast 后面的时候,那么 DToast 无法弹出】
机型:
三星Galaxy S10
samsung SM-G9730
Android 11
One UI 3.1
说明:
代码调试走的是 SystemTN
com.dovar.dtoast.inner.SystemTN#displayToast
当activity销毁时,调用DToast.cancel(),吐司却不能立马消失,这是机制的问题吗。
ActivityToast显示时,如果快速按返回键返回上个页面,这个时候Toast会闪一下,控制台日志如下:
01-28 14:28:12.808 539-539/com.dovar.dtoast E/WindowManager: android.view.WindowLeaked: Activity com.dovar.dovatoast.SecondActivity has leaked window android.widget.RelativeLayout{2d488bc V.E...... ......ID 0,0-311,103} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:505)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:346)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
at com.dovar.dtoast.inner.DovaTN.displayToast(DovaTN.java:194)
at com.dovar.dtoast.inner.DovaTN.showNextToast(DovaTN.java:156)
at com.dovar.dtoast.inner.DovaTN.notifyNewToastComeIn(DovaTN.java:90)
at com.dovar.dtoast.inner.DovaTN.add(DovaTN.java:55)
at com.dovar.dtoast.inner.DovaToast.show(DovaToast.java:72)
at com.dovar.dovatoast.ToastUtil.show(ToastUtil.java:27)
at com.dovar.dovatoast.SecondActivity.onClick(SecondActivity.java:30)
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:385)
at android.view.View.performClick(View.java:6303)
at android.view.View$PerformClick.run(View.java:24828)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6809)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
有没有遇到这个问题
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.