Created
June 14, 2020 04:29
-
-
Save peterpazmandi/7e5305b405794e2ee2df25f8a42b6ff0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Toast.showCustomToast(message: String, activity: Activity) | |
{ | |
val layout = activity.layoutInflater.inflate ( | |
R.layout.custom_toast, | |
activity.findViewById(R.id.cl_customToastContainer) | |
) | |
val textView = layout.findViewById<TextView>(R.id.tv_message) | |
textView.text = message | |
this.apply { | |
setGravity(Gravity.BOTTOM, 0, 40) | |
duration = Toast.LENGTH_LONG | |
view = layout | |
show() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment