How to bring ImageView in front of Button in android 5?

前端 未结 2 1300
执念已碎
执念已碎 2020-12-10 12:39

In android versions previous to lolipop, the following code works and an image is in front of the button. But in android 5 the imageview is put behind the button.

         


        
2条回答
  •  囚心锁ツ
    2020-12-10 13:28

    Button elevation and translationZ values are defined in framework as below:

    
    1dp
    
    2dp
    

    Source

    Like CommonsWare explained, set the translationZ of ImageView higher than Button value will give the result as expected.

提交回复
热议问题