Changing Android SVG graphic color programmatically By Zoranin Tutorials - February 4, 2022 Comments: 0 Views: 701 You can use vector graphics on Android and change the graphic color with code. In this way, it is not necessary to use different graphics for each color.The actions I wanted to do were:- Being able to choose colors for a folder list and folder icons in the list.- Using a single vector graphic.My actions:I downloaded an icon from FontAwesome in SVG format.Then it was necessary to transfer it to Android Studio. But the format drawable of the icon I downloaded for this process is incompatible. I used the svg2android tool to SVG convert it to the appropriate format. In this way, I converted the Site to Drawable XML format and included it in the project. SVGIn order to use it properly in Layout, I converted it to XML as src and added the folder icon that I added to the project. We can specify the color we want to give the gold as the tint . Of course, we can change this color programmatically afterwards.I am using the layout here as ListView row. I can define a different color for the icon in each line. The name of the model I use is Folder . There is a title and color data for each folder model. The folder.getColor() in the code is the hex color code of the current folder. Example: #FF0000We convert hex color code to int color code with color.parseColor(folder.getColor()) . Then we change the color of the graphic using the android.graphics.PorterDuff.Mode.SRC_IN mode with setColorFilterholder.folder.setColorFilter(Color.parseColor(folder.getColor()), android.graphics.PorterDuff.Mode.SRC_IN);
How to develop your first app with React Native I want to talk a little about what React Native is, why it is important and popular now, and January 24, 2022 Tutorials
Important little things when developing mobile applications Probably, you have repeatedly searched the markets for a mobile application for some keyword, January 13, 2022 Blog
How to quickly write an Android game with Unity At the present time, anyone can become a successful mobile game or application developer without January 9, 2022 Tutorials