Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between android:tint and android:fillColor in VectorDrawables?

Usually when we create a new Vector Asset Clip Art inside android studio the ide create an xml code like this

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:tint="#FFFFFF"
    android:height="24dp"
    android:viewportHeight="24.0"
    android:viewportWidth="24.0"
    android:width="24dp" 
    >
    <path 
      android:fillColor="#FF000000"
      android:pathData="M21,6h-2v9L6,15v2c0,0.55 0.45,1 1,1h11l4,4L22,7c0,-0.55 -0.45,-1 -1,-1zM17,12L17,3c0,-0.55 -0.45,-1 -1,-1L3,2c-0.55,0 -1,0.45 -1,1v14l4,-4h10c0.55,0 1,-0.45 1,-1z"/>
</vector>

we notice that there is two different attributes has a color value tint and fillColor what is the diffrences between those attributes and how they effect on the icon?

like image 254
Abdulmalek Dery Avatar asked Aug 12 '18 20:08

Abdulmalek Dery


People also ask

What is android tint?

Tint color means when we want to change the color of the image while rendering in ImageView. In XML is very easy to change tint color by just setting up the attribute android:tint="" in the ImageView tag, as shown in the following example.

What is VectorDrawable?

A VectorDrawable is a vector graphic defined in an XML file as a set of points, lines, and curves along with its associated color information. The major advantage of using a vector drawable is image scalability.

What is android path data?

PathData in vector images android is Vector graphic program's script. It is not exactly clean and human readable code as a high priority.

What is vector in Android studio?

Android Studio includes a tool called Vector Asset Studio that helps you add material icons and import Scalable Vector Graphic (SVG) and Adobe Photoshop Document (PSD) files into your project as vector drawable resources.


1 Answers

The fill color is the color the path is filled with. A tint just filters the colors with that shade. It's like a semi-transparent overlay to nudge the pixels towards that color. You can easily change the tint in the various display properties you can't necessarily recolor paths. It will also let you reuse the icon with different color schemes more effectively.

like image 131
Tatarize Avatar answered Nov 03 '22 00:11

Tatarize