0

Am trying to add elevation to my layouts in styles but the android:elevation is only available for lollipop not pre lollipop. This is my layout in v21. which am trying to achieve for pre-lollipop

My styles for v14

    <style name="AppBaseTheme" parent="Theme.AppCompat">
        <!-- API 14 theme customizations can go here. -->
<android:elevation="4dp"> // Doesn't work here 
</style>

Is it possible to achieve this effect? Any pointers will be great. Thanks.

CodeZero
  • 179
  • 2
  • 15
  • possible duplicate of [Elevation effect for ImageButton on Pre-Lollipop devices](http://stackoverflow.com/questions/27432343/elevation-effect-for-imagebutton-on-pre-lollipop-devices) – EE66 Jul 04 '15 at 08:55
  • This is not a duplicate. The disconnect text is actually a textview not a button – CodeZero Jul 04 '15 at 09:16

2 Answers2

0

No you cannot add elevation in pre-Lollipop devices.

Still you can use a shadow like image and put it there to get such an effect. But it is not a good idea.

Azim Ansari
  • 1,378
  • 11
  • 20
  • So your saying I should add shadow images around my layouts? That seems illogical. – CodeZero Jul 04 '15 at 09:18
  • Ha Ha. That's why developers say don't use shadow property in pre-lollipop devices. nobody will recommend you that. Leave it as it is. – Azim Ansari Jul 04 '15 at 09:20
0

So i found a solution to my problem and felt i should post it. Those that wish to achieve the elevation effect should just add this to their layout android:background="@android:drawable/dialog_holo_light_frame . This gives an elevated effect on any layout.

CodeZero
  • 179
  • 2
  • 15