Ripple requires API level 21 (current minimum 11), android?

I have the below

<?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 get this error

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

How to solve it?

+5
source share
2 answers

You are using minsdk = 11.

You cannot use this drawable with api <21.

You must use different versions of this file. Put this code in res/drawable-v21/myRipple.xml and create another res/drawable/myRipple.xml

+19
source

Although it’s true that the tag was added in API 21, RippleDrawable is quite simple and can be moved back to API 1. There are many libraries that reverse the ripple for older devices. For an example implementation, see:

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

0
source

Source: https://habr.com/ru/post/1215804/


All Articles