Closed chaudharyvikram closed 3 years ago
I added specific string instead of color in xml and replaced that string with my color while processing xml as below:
Code in cyborg
var data = data
if var strXML = String(data: data, encoding: .utf8) {
strXML = strXML.replacingOccurrences(of: "#COLOR#", with: fillColor)
if let dt = strXML.data(using: .utf8) {
data = dt
}
}
I edited xml as below
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#COLOR#" android:pathData="M20,3h-1L19,1h-2v2L7,3L7,1L5,1v2L4,3c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,5c0,-1.1 -0.9,-2 -2,-2zM20,21L4,21L4,8h16v13z"/>
</vector>
I want to set different fill color for same vector xml file for different screen. Is there any way to change android:fillColor programatically?