读书人

多个Toast同时显示时希望同时显示在

发布时间: 2013-08-09 15:16:24 作者: rapoo

多个Toast同时显示时,希望同时显示在屏幕而不是依次显示,怎么办?
多个toast同时显示时,默认是toast按时间依次显示,这个效果不好。希望做一个按照位置不同,但能够同时显示在屏幕上。怎么做?
[解决办法]

        if (mNextView == null) {
throw new RuntimeException("setView must have been called");
}

INotificationManager service = getService();
String pkg = mContext.getPackageName();
TN tn = mTN;
tn.mNextView = mNextView;

try {
service.enqueueToast(pkg, tn, mDuration);
} catch (RemoteException e) {
// Empty
}


看名字就晓得 toast 是放到一个队列里面 显示的

自己写窗口吧

读书人网 >Android

热点推荐