How to bring view in front of everything?

Lukap picture Lukap · Jul 20, 2011 · Viewed 195.2k times · Source

I have activity and a lot of widgets on it, some of them have animations and because of the animations some of the widgets are moving (translating) one over another. For example the text view is moving over some buttons . . .

Now the thing is I want the buttons to be always on the front. And when the textview is moving I want to move behind the buttons.

I can not achieve this I tried everything I know, and "bringToFront()" definitelly doesn't work.

note I do not want to control the z-order by the order of placing element to layout cause I simply can't :), the layout is complex and I can not place all the buttons at the begging of the layout

Answer

Medo Elkamaly picture Medo Elkamaly · Apr 18, 2014

You can call bringToFront() on the view you want to get in the front

This is an example:

    yourView.bringToFront();