android-vectordrawable

Is there a way to listen for animation end in AnimatedVectorDrawables

匆匆过客 提交于 2019-12-08 23:19:38
问题 I have created an AnimatedVectorDrawable, it works pretty well, now I am looking for a way to change the animation or hide the view after it finishes. I was hoping there was a listener but it doesn't look like there is. Can someone help? EDIT So I found a workaround, but not a very elegant way. What I did was create a thread and poll if the animation is running. new Runnable() { public void run() { while(mLoop) { if(mAnimatedVectorDrawable.isRunning()) { Thread.sleep(mPollingInterval); } else

Create VectorDrawable from String (path)?

自作多情 提交于 2019-12-08 16:47:35
问题 Is there a way to get SVG path string from the API and create VectorDrawable dynamically? I have been trying to do this for hours without success. Even more, all (!) examples on the Internet explain creating VectorDrawable from XML resources. In my case, XML resource file is pointless as I am trying to fetch SVG path from the Internet API. 回答1: Inflating a drawable from a XML file instead of from resources is actually impossible, because the drawable will try to cast the XmlPullParser to

Create Vector Drawable from String with multiple path tags (Android)

☆樱花仙子☆ 提交于 2019-12-08 12:52:42
问题 I was working on sending vector drawables from server to my application. I wanted to implement a function which gets a list of path data and color and creates a vector drawable from the given list of String/Color pairs. I used the answer Nicolas provided on a similar thread (Create VectorDrawable from String (path)?) But it fails when given multiple path/color pair items. Can anyone help me with with finding the bug? the code seems OK to me. Here is my code: private static final byte[][] BIN

Flood fill algorithm on vector drawable image view

我的梦境 提交于 2019-12-08 06:05:29
问题 I want to create application like this. Flood fill algorithm I applied that code and it is working fine with JPG or PNG file. But I want to use that algorithm with Vector drawable imageview Vector drawable imageview before flood fill After flood fill of vector imageview Expected result should be like this (Flood fill work perfectly when I set JPG or PNG file) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity

How to create ObjectAnimator with valueType - pathType programmatically?

送分小仙女□ 提交于 2019-12-08 03:36:37
问题 I would like to create a ObjectAnimator programmatically that represents this xml - <objectAnimator android:duration="@integer/eye_anim_duration" android:interpolator="@android:interpolator/anticipate_overshoot" android:propertyName="pathData" android:repeatCount="0" android:repeatMode="restart" android:valueFrom="@string/big" android:valueTo="@string/small" android:valueType="pathType" /> In similar fashion as I can create a ObjectAnimator for color change - ValueAnimator animator =

How to create ObjectAnimator with valueType - pathType programmatically?

人盡茶涼 提交于 2019-12-07 00:19:33
I would like to create a ObjectAnimator programmatically that represents this xml - <objectAnimator android:duration="@integer/eye_anim_duration" android:interpolator="@android:interpolator/anticipate_overshoot" android:propertyName="pathData" android:repeatCount="0" android:repeatMode="restart" android:valueFrom="@string/big" android:valueTo="@string/small" android:valueType="pathType" /> In similar fashion as I can create a ObjectAnimator for color change - ValueAnimator animator = ObjectAnimator.ofInt(vector, "fillColor", getResources().getColor(R.color.light_green), getResources().getColor

AndroidStudio import SVG with ERROR@ <mask> is not supported

旧街凉风 提交于 2019-12-06 17:23:53
问题 I got message "ERROR@ <mask> is not supported" when try to import SVG using Android Studio 3.0.1 Build #AI-171.4443003, built on November 10, 2017 JRE: 1.8.0_152-release-915-b08 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.12.6 Anyway to import SVG and make them show correctly? 回答1: Solution 1 Flattern image in Sketch and use this site to convert SVG to xml for Android Solution 2 I use nonZero instead of evenOdd and open it in Sketch to reverse Order after reverse it

How to access or translate text in Vector Drawables

隐身守侯 提交于 2019-12-06 07:49:31
问题 I have a custom view which displays a drawable and detects touches. It has a number of drawable layers, some of which contain text, for example, I have converted each SVG vector graphic into a vector drawable and want to be able to set the text to be a resource so I can substitute different translations. The SVG xml code for the 'Hello box' above :- <svg width="800" height="400" viewBox="0 0 800 400.00001" id="svg5772" version="1.1" inkscape:version="0.91 r13725" sodipodi:docname="HELLO in a

VectorDrawable rendering issue

邮差的信 提交于 2019-12-05 14:43:33
问题 I'm having problems with the VectorDrawables introduced by the support library. Looking around, I read about similar issues regarding bad scaling or incorrect preview in Android Studio. Well, my problem is unluckily different. PROBLEM: In fact, my VectorDrawable renders perfectly in the Android Studio preview but gets messed up at runtime on device (Android v. 5.1.1 and 6.0). EXPORTING: Starting from an SVG file (with only one compounded path), I imported it with the Android Studio tool (but

How to animate a VectorDrawable in a fluid-like manner?

情到浓时终转凉″ 提交于 2019-12-05 08:16:55
Background Suppose I have a VectorDrawable that look like a top->down arrow: <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:pathData="M20,12l-1.41,-1.41L13,16.17V4h-2v12.17l-5.58,-5.59L4,12l8,8 8,-8z" android:fillColor="#010101"/> </vector> I want to show an animation of it that looks like a fluid that it poured, so that first nothing is shown, then the top area, then also the mid area, and then the bottom. After all is shown, it begins to hide, so that the