代码改变世界

Toast实现显示

// 第一个参数:当前的上下文环境。可用getApplicationContext()或this

 // 第二个参数:要显示的字符串。也可是R.string中字符串ID

 // 第三个参数:显示的时间长短。Toast默认的有两个LENGTH_LONG(长)和LENGTH_SHORT(短),也可以使用毫秒如2000ms  

Toast toast=Toast.makeText(getApplicationContext(), "默认的Toast", Toast.LENGTH_SHORT);

 //显示toast信息  

toast.show(); 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
  • 2021-11-30
  • 2021-09-18
  • 2021-10-18
  • 2021-04-09
猜你喜欢
  • 2021-09-21
  • 2021-07-12
  • 2021-07-05
  • 2022-12-23
  • 2021-11-28
  • 2021-11-06
  • 2021-07-18
相关资源
相似解决方案