Skip to content Skip to sidebar Skip to footer

Elevation Effect For Imagebutton On Pre-lollipop Devices

I am trying the apply elevation effect for ImageButton. It works well on my Nexus tablet running Android 5.0 but elevation does not work on Pre-Lollipop devices. Tried ViewCompat.s

Solution 1:

You cannot use elevation pre 5.0, you need to provide an image with a "shadow" to make it appear like its elevated

Solution 2:

It's true than you cannot do it now but for different reason.

There is a setElevation method inter support library for pre Lollipop. But I think it's buggy and still is not usable with all types of views.

Check it out here

http://developer.android.com/reference/android/support/v4/view/ViewCompat.html#setElevation(android.view.View,%20float)

Edit: sorry, I noticed now you already tried it. I hope Google has plans to fix this soon

Solution 3:

as mentioned in this post set background to

android:background="@android:drawable/dialog_holo_light_frame"

it looks like raised button on pre lollipop.

Post a Comment for "Elevation Effect For Imagebutton On Pre-lollipop Devices"