android-vectordrawable

How to restart android AnimatedVectorDrawables animations?

流过昼夜 提交于 2019-11-30 19:02: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:drawable"> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width=

Can we use VectorDrawable or VectorXML as icons for push notifications in android?

倖福魔咒の 提交于 2019-11-30 17:13:09
I am using PNG image but its size is getting too big so I have to compromise with its quality. So i was thinking vectors may be the another way around ? Example will be a great help. Can we use VectorDrawable or VectorXML as icons for push notifications? Yes, just call the vector drawable the standard way for notifications: .setSmallIcon(R.drawable.my_vector) In order to use the transparency (notification icons are only white and/or transparent), you will have to use the alpha channels when settings the colors in the vector XML, meaning #00000000 for transparent and #FFFFFFFF for white. Farbod

Can we use VectorDrawable or VectorXML as icons for push notifications in android?

﹥>﹥吖頭↗ 提交于 2019-11-30 16:28:10
问题 I am using PNG image but its size is getting too big so I have to compromise with its quality. So i was thinking vectors may be the another way around ? Example will be a great help. 回答1: Can we use VectorDrawable or VectorXML as icons for push notifications? Yes, just call the vector drawable the standard way for notifications: .setSmallIcon(R.drawable.my_vector) In order to use the transparency (notification icons are only white and/or transparent), you will have to use the alpha channels

How to get a Bitmap from VectorDrawable

拟墨画扇 提交于 2019-11-30 15:35:19
问题 I'm still trying to solve the problem I've had since a couple of days ago and I still have not found a solution. However, I am getting there step by step. Now I have run into another roadblock. I am trying to get Bitmap.getpixel(int x, int y) to return the Color of what the user has touched using OnTouchListener . The pie is a VectorDrawable resource, vectordrawable.xml I don't need to do anything with the pixel data yet, I just need to test it. So I made a TextView that will spit out the

How to get a Bitmap from VectorDrawable

蹲街弑〆低调 提交于 2019-11-30 15:22:50
I'm still trying to solve the problem I've had since a couple of days ago and I still have not found a solution. However, I am getting there step by step. Now I have run into another roadblock. I am trying to get Bitmap.getpixel(int x, int y) to return the Color of what the user has touched using OnTouchListener . The pie is a VectorDrawable resource, vectordrawable.xml I don't need to do anything with the pixel data yet, I just need to test it. So I made a TextView that will spit out the Color touched. public class MainActivity extends AppCompatActivity { ImageView imageView; TextView

Load a vector drawable into imageview from sd card

让人想犯罪 __ 提交于 2019-11-30 14:17:54
问题 I want to show a vector image (say vectorimage.xml) in an imageview from the sd card. Please throw some insight on how to do this in android. What I have tried already :- String imagePath = Environment.getExternalStorageDirectory() + "/ folder/productImage.xml"; bitmapImage = BitmapFactory.decodeFile(imagePath); Drawable bgrImageDrawable = new BitmapDrawable(bitmapImage); The above code snippet does not work since the bitmapImage is coming as null. 回答1: The BitmapFactory can't load vector

Android: How to set stroke color for vector drawable programmatically

試著忘記壹切 提交于 2019-11-30 13:21:37
问题 I am getting into a trouble with VectorDrawable in Android. I have a vector drawable file (.xml) and I want to draw it on bitmap. I managed to load this file and draw it on bitmap. I can change its fill color but the problem is that I cannot change its stroke and color. Any helps would be appreciated!!! Thank you! Here is the drawable file: <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="312dp" android:height="312dp" android:viewportWidth="312.7" android

Programmatically tint a Support Vector

╄→гoц情女王★ 提交于 2019-11-30 11:37:47
Android Studio version 2.1, gradle version 2.1.0, please correct me if you spot any misinterpretations :) I am confused about support vectors in the support library 23.3.0. Specifically what I would like to do is tint an image button programmatically, whose src is defined is a vector drawable. From what I can tell this is not possible on pre-lollipop now. I have read several related posts about the changes: 23.2.0 announcement and changes : As of Android Support Library 23.3.0, support vector drawables can only be loaded via app:srcCompat or setImageResource(). Does the above mean that vector

Change fillColor of a vector in android programmatically

走远了吗. 提交于 2019-11-30 10:50:44
I want to edit the fill Color of a vector-file in Android programmatically. In the xml-file I can set my color with the attribute android:fillColor but I want to change the color in runtime. Any examples for that? Thanks. This is exactly what you need. Credits to @emmaguy , the author of the post. I just added the full support of Support Library 23.4+ , which enables you to stop generating pngs at runtime: // Gradle Plugin 2.0+ android { defaultConfig { vectorDrawables.useSupportLibrary = true } } And if this line is set on your Activity's or Application's onCreate: AppCompatDelegate

Load a vector drawable into imageview from sd card

偶尔善良 提交于 2019-11-30 10:08:25
I want to show a vector image (say vectorimage.xml) in an imageview from the sd card. Please throw some insight on how to do this in android. What I have tried already :- String imagePath = Environment.getExternalStorageDirectory() + "/ folder/productImage.xml"; bitmapImage = BitmapFactory.decodeFile(imagePath); Drawable bgrImageDrawable = new BitmapDrawable(bitmapImage); The above code snippet does not work since the bitmapImage is coming as null. The BitmapFactory can't load vector drawables. You have to use the VectorDrawable or VectorDrawableCompat class. To load a vector drawable you need