Binil Surendran
Binil Surendran

Reputation: 51

Android : Card view not run in lower version of "Android L"

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.

Upvotes: 0

Views: 674

Answers (2)

WenChao
WenChao

Reputation: 3665

possible duplicated. Android AppCompat 21 Elevation

Basically setElevation from ViewCompat won't even work.

Upvotes: 1

Buddy
Buddy

Reputation: 11038

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.

Upvotes: 0

Related Questions