How to know if a view is visible or not when other view is over it?

Viewed 37

How could I programmatically know on an Android app if the icon is visible or not according to the transparency of the view over it?

See that this is not a trivial question. I want to know if the icon is visible by the naked eye on its totality, independently of the complexity of the view over it.

Two devices shows a view over an icon. In the first one the icon is not visible, because the view over it has a solid color. In the second one, the icon is visible, since the view over it is transparent.

1 Answers

For kotlin use if((yourView).visibility == View.VISIBLE).

then check alpha of the view that is overlapping your view if it is more than a certain threshold yourView is visible otherwise it just cannot be considered visible.

Related