Android Floating Notice (View) NOT popup

34 Views Asked by At

enter image description here

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:

  1. 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.

  2. 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

1

There are 1 best solutions below

3
rehan.ankalgi On

You can use Toasts to show timed message just like the alert() in javascript.

here is the reference page for the same https://developer.android.com/guide/topics/ui/notifiers/toasts#kotlin