Ripple requires API level 21 (current min is 11), android?
Asked Answered
A

2

6

I have the below drawable

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:colorControlHighlight" >

<item>
    <shape android:shape="oval" >
        <solid android:color="?android:colorAccent" />
    </shape>
</item>

And I am getting this error

<ripple> requires API level 21 (current min is 11)

How do I solve it?

Aeronaut answered 21/3, 2015 at 6:23 Comment(0)
U
20

You are using minsdk=11.

You can't use this drawable with api<21.

You have to use diffent versions of this drawable file.
Put this code in res/drawable-v21/myRipple.xml and create a different res/drawable/myRipple.xml

Uncovered answered 21/3, 2015 at 7:12 Comment(0)
T
1

While it's true that the tag was added in API 21, RippleDrawable is pretty simple and it's possible to port it back to API 1. There's a good number of libraries backporting the ripple for older devices. For a sample implementation see:

https://github.com/ZieIony/Carbon/blob/master/carbon/src/main/java/carbon/drawable/ripple/RippleDrawableICS.java

Tontine answered 21/3, 2015 at 13:9 Comment(2)
updated - the file was there, but was changed since MarchTontine
Fixed. Froyo is no longer supportedTontine

© 2022 - 2024 — McMap. All rights reserved.