How can I change default toast message color and background color in android?

后端 未结 15 841
执念已碎
执念已碎 2020-12-23 17:12

I want to create a toast message with background color is white and message color is black. My toast message is:

Toast.makeText(Logpage.this, \"Please Give          


        
15条回答
  •  春和景丽
    2020-12-23 17:46

    Kotlin Version:

    val toast:Toast = Toast.makeText(this, "Please enter your name !", Toast.LENGTH_SHORT)
    val view = toast.view
    view?.background?.setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN)
    toast.show()
    

提交回复
热议问题