📜  如何阻止 toast 消息重叠 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:39.055000             🧑  作者: Mango

代码示例1
final Toast tst = Toast.makeText(ctx, "This is a toast.", Toast.LENGTH_SHORT);
tst.show();

Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
       @Override
       public void run() {
           tst.cancel(); 
           tst.setText("Same toast with another message.");
           tst.show();
       }
}, 1000);