红米Note5 Toast带有应用名称的问题
2019-03-20 本文已影响0人
百度不清
问题:
在使用红米Note5调试时,发现Toast前面带有应用名称。
![](https://img.haomeiwen.com/i16118656/796403fc2a9fcb59.png)
解决方案:
toast = Toast.makeText(context.getApplicationContext(), msg, Toast.LENGTH_SHORT);
toast.setText(msg);
toast.show();
初始化toast之后,再重新设置一下text,即可正常显示。
另外发现一个问题,传入Activity或者Fragment的Context 会影响Toast的样式显示显示,当传入context.getApplicationContext()时,Toast样式显示正常。
![](https://img.haomeiwen.com/i16118656/77a41ce0901f534e.png)