Open zeeshanrasool91 opened 2 years ago
This has been done already. Please check the latest release: https://github.com/devendroid/VectorChildFinder/releases/tag/1.0.1
The version 1.0.1 has an error in jitpack, can't download
@IsLery The version doesn't have any known errors. Share your stack trace.
@devmike01 could you please take a look?
Hi @IsLery , I'm looking into this now.
I have submitted a PR to fix this. However, while waiting for approval you can use this: implementation 'com.github.devmike01:VectorChildFinder:1.1.1-beta'
@IsLery
This can be done through Java reflection. First reflect call VectorDrawable.getTargetByName or VectorDrawableCompat.getTargetByName method to get VFullPath:
Object path = ReflectUtil.invoke(vectorDrawable, "getTargetByName", new Class[]{String.class}, new Object[]{pathName});
Then Reflect calls the VFullPath.setFillColor method to set the color:ReflectUtil.invoke(path, "setFillColor", new Class[]{int.class}, new Object[]{color});