android - How to implement animated vector drawables using the design support library 23.2? -
i've seen android developers blog new design support library 23.2 supports animated vector. when searched came across link implement animated vector drawable. same way implement animated vector drawables in design support library 23.2? can me out new implementation?
here's link example project on github implementing support library make floating action button.
using support library similar non-support library method in xml files animatedvectordrawables same, objectanimators , static vectordrawables.
the differences come when setting project use support library , when referring animatedvectordrawables in code.
make sure using @ least version 23.2.0 of appcompat in build.gradle, vectordrawable , animatedvectordrawable libraries not need added separately:
dependencies { ... ... compile 'com.android.support:appcompat-v7:23.2.0' }
the official anouncement blog linked to gives couple of different ways ensure android studio not convert vector drawables pngs. there 2 different methods depending on version of gradle plugin using, should follow appropriate one.
to call animated vector resources in code:
animatedvectordrawablecompat animatedvector = animatedvectordrawablecompat.create(this, r.drawable.animated_vector_name);
you can display on imageviews, buttons etc. .setimagedrawable(animatedvector);
method, , start animation using animatedvector.start();
important note: mentioned in chris banes' post, there limitations work in support library. sqisland.com post linked includes examples of path morphing, won't work current support library(version 23.2.0)
Comments
Post a Comment