基于以下链接:
Best practice: Extending or overriding an Android library project class
https://developer.android.com/studio/write/add-resources.html#resource_merging
Android库(AAR)中的类和资源是可重写的。如何覆盖资产文件?在我的AAR文件中,有一个名为first.xml
的资产。我想在我的Android项目中创建自己的first.xml
,该项目覆盖AAR中的文件。我该怎么办?
这是我在AAR中的资产/:
-assets/
-a.xml
-b.xml
这是我的Android项目中的资产/,取决于上面的AAR:
-assets/ -b.xml -c.xml
我的APK中的结果资产/如下:
-assets/ -a.xml (from AAR) -b.xml (from my project) -c.xml (from my project)