I want to change z order of some views during animation

On Androids above 4.1.2 it works just fine, and on androids below 4.1.2 the Z order doesnt change, the top view remains on top.

This is what i am trying. 

```
myView.bringToFront();
((View)myView.getParent()).invalidate();

```

How to make it work on older devices ?
['https://Stackoverflow.com/questions/25306180', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2136812/']
I tried all that. A RelativeLayout was supposed to be on top of a Button but it just didn't want to obey.

In the end I solved it by adding `android:elevation="2dp"` to the RelativeLayout.

The elevation value is only used in API level 21 and higher. In my case everything below the API level 21 was fine and everything above wasn't.

Hope this might help someone :)
For Api's 21 or above There is an xml attribute known as `translateZ` which lets you define the elevation level on the view.

You can pretty much use that too.

> 
> android:translateZ="30dp" 
> 
> 
> 

\*APIs >=21