0

I am developing an app for Card View.Implement two features of card view "setRadius()" and "setElevation()" .It is working fine in Android L.

But when I run the app in API 19 (KitKat) , card view setElevation() getting an error

java.lang.NoSuchMethodError: android.view.View.setElevation"

Can any one please help me to make this app compatible to all version.

Binil Surendran
  • 51
  • 2
  • 11

2 Answers2

1

possible duplicated. Android AppCompat 21 Elevation

Basically setElevation from ViewCompat won't even work.

Community
  • 1
  • 1
WenChao
  • 3,586
  • 6
  • 32
  • 46
0

Take a look at the docs for setElevation and you can see that it was added in API 21 (which is Lollipop).

You can, however, use the ViewCompat library's version of setElevation, and then it should work on lower API levels.

Buddy
  • 10,874
  • 5
  • 41
  • 58