android-vectordrawable

Is there a way to listen for animation end in AnimatedVectorDrawables

走远了吗. 提交于 2019-11-30 08:11:37
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 { mLoop = false; // TODO what ever } } } }; If somebody finds a better solution, please share. My

VectorDrawable: Invalid drawable tag gradient

筅森魡賤 提交于 2019-11-30 07:10:47
问题 I have been using the Android Asset Studio to generate vector drawables from SVG files exported from Zeplin for a while and except a few times, it works fine. But today I got this exception when I was trying to use a generated vector drawable. android.view.InflateException: Binary XML file line #0: Error inflating class <unknown> And in the same stacktrace: Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #0: invalid drawable tag gradient I do not know a lot about Vector

How to set VectorDrawable as an image for ImageView programmatically

吃可爱长大的小学妹 提交于 2019-11-30 01:14:33
I want to set some vectorDrawables to a ImageView in Android Studio. I can set png and jpg drawable easily but when i want to set VectorDrawable, it does not work on imageview. img.setImageResource(R.drawable.ic_home); ic_home is VectorDrawable and this code doesn't work. Pramod Baggolli If you want to use vector drawables (less OR greater than API 21) just do the following: Set the image programmatically (e.g. in your activity): imageView.setImageResource(R.drawable.ic_left_arrow_blue); or by XML: app:srcCompat="@drawable/your_vector_name" In your app's build.gradle you need to include:

SplashScreen with Vector stretched full screen

心已入冬 提交于 2019-11-29 23:36:12
I did my splash screen with this tutorial and it works great. https://www.bignerdranch.com/blog/splash-screens-the-right-way/ Basically I set up a splascreen through theme: <style name="ThemeSplash" parent="Theme.AppCompat.NoActionBar"> <item name="android:windowBackground">@drawable/drawable_splashcreen</item> </style> I wanted to put a vector image inside like this: (drawable_splashcreen) <item android:drawable="@color/color_background_splash_screen" /> <item android:drawable="@drawable/vector_najdiflet_logo" /> The image will streched through the full screen. On API 23 it works like it

How to restart android AnimatedVectorDrawables animations?

╄→гoц情女王★ 提交于 2019-11-29 19:17:45
问题 I have a kinda complex vector drawable that I want to animate. I used @RomanNurik's web tool to create the animation from a svg That gives me a valid <animated-vector> according to the documentatios. It's an "all in one" XML file. The xml has the drawable divided in 2 groups, each group containing 2 paths and has also added 4 animations, just as follows: <animated-vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"> <aapt:attr name=

Android: getting Resources$NotFoundException for abc_ic_ab_back_material

坚强是说给别人听的谎言 提交于 2019-11-29 09:52:40
I'm getting a Resources$notfoundexception on older (pre-L) devices. I'm including the full stacktrace below. My version of the support library is the latest (24.1.0), and I've included in my gradle file the line: vectorDrawables.useSupportLibrary = true My base theme is a noactionbar theme - "Theme.AppCompat.Light.NoActionBar" The crash is happening on this line in my code where I reference the back arrow in a support-toolbar in order to later change it's color: @SuppressLint("PrivateResource") final Drawable upArrow = ContextCompat.getDrawable(this, R.drawable.abc_ic_ab_back_material); What

Invalid drawable tag vector

杀马特。学长 韩版系。学妹 提交于 2019-11-29 05:59:27
问题 Im trying to use vector drawables on pre lollipop devices. I did all as instructed here but i still get this crash. build.gradle: buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta6' } } apply plugin: 'com.android.application' repositories { maven { url 'http://maven.android-forever.com' } jcenter() } android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.test.app" minSdkVersion 16 targetSdkVersion

VectorDrawable: Invalid drawable tag gradient

徘徊边缘 提交于 2019-11-29 01:56:37
I have been using the Android Asset Studio to generate vector drawables from SVG files exported from Zeplin for a while and except a few times, it works fine. But today I got this exception when I was trying to use a generated vector drawable. android.view.InflateException: Binary XML file line #0: Error inflating class <unknown> And in the same stacktrace: Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #0: invalid drawable tag gradient I do not know a lot about Vector drawables and SVGs in Android. Are gradients not supported in Vector drawables? Is there any fix for

VectorDrawable not rendering correctly on API 23

泄露秘密 提交于 2019-11-28 22:23:07
问题 I am replacing all my icons with VectorDrawables wherever possible. But I noticed a couple of them don't render correctly on API 23 and the color seems to be bleeding out. One of these 3 renders fine. Here's a screenshot from a isolated project I created: Looks perfectly fine on API 21: The source code of sample app is here I am using AppCompat 24.0.0, app:srcCompat on ImageView and have set vectorDrawables.useSupportLibrary=true. I also tried AppCompat 23.4.0 with target 23. However, if I

Vector Drawable in Layer List on Older Android Versions

拜拜、爱过 提交于 2019-11-28 21:08:23
On newer Android versions, the following code: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="oval"> <solid android:color="#bdbdbd" /> <size android:width="60dp" android:height="60dp" /> </shape> </item> <item android:drawable="@drawable/ic_library_books_black_24dp" android:gravity="center" android:width="40dp" android:height="40dp" > </item> </layer-list> produces this flawlessly: However, earlier Android versions (API 16 and 19, from what I've tested) do not like this at all and I get E