'How to customize a vector in Android Studio?
I am working with an Android app (using API 21) in which I can change the color of a vector manually depends on previous Activity, but I have a problem, I can not access the 'Path' object in my xml file
<!-- drawable/chevron_left.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:name="left"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:id="@+id/chervon_left"
android:fillColor="#000"
android:pathData="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z" />
</vector>
So how can I customize this vector in MainActivity.java file ? I read this but it did not work: Working with Drawables
Solution 1:[1]
basically, use @color.
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:name="left"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:id="@+id/chervon_left"
android:fillColor="@color/purple_200"
android:pathData="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z" />
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ramazan Akbal |