How to use PathInterpolatorCompat
I'm trying to use PathInterpolator
from android.support.v4.view.animation.PathInterpolatorCompat
because wo PathInterpolator
n't work in my device API 18, since it was added in API 21.
I downloaded the support repository and included the following in the application directory build.gradle
:
compile "com.android.support:support-v4:21.0.0"
I am trying to use it like this:
PathInterpolator p_interpolator = new PathInterpolator(.5f,1.0f);
However, in Android Studio, it asks to import from: android.view.animation.PathInterpolator
instead of giving me an option for a compatible version.
What do I need to do?
Editor's note: Correct usage PathInterpolatorCompat
(as pointed out by @fernforce in a comment on the accepted answer):
PathInterpolator p_interpolator = PathInterpolatorCompat.create(.5f,1.0f);
source to share
PathInterpolatorCompat
is available in the support library since version 22.1.0. To fix this, just change your gradle declaration to use the latest version:
compile "com.android.support:support-v4:22.1.1"
See v22.1 support library announcement for more details .
source to share