I have a few custom views in my Android project and I\'ve added the relevant details to the attrs.xml file. And now I can implement my objects through XML. This works fine.
try this solution
reference(Chinese)
if you guys think it useful,I will translate it.