I am trying to implement a custom view like this (TextView with close button) in Android.
This view can be attached shown any place on the screen. I am trying to use Canvas but not sure how I can use it like wrap content. I tried to override onMesaure method and I can see that the canvas is smaller now but not able to bring down that canvas.
Questions:
How I can make sure canvas is not bigger than it's content and same time I can make it visible around any existing view on the screen.
Or is there anything else I should use?
NOTE 1: This should not be the popup
NOTE 2 : This can not be the toast as it should stay until use close this

You can use
Toaststo show timed message just like thealert()in javascript.here is the reference page for the same https://developer.android.com/guide/topics/ui/notifiers/toasts#kotlin