查看了xrecyclerview的源码,loadmore的加载样式是LoadingMoreFooter实现的。LoadingMoreFooter中没有给出修改的方法。那么只有将recyclerview项目导为module,修改其源码。
- 导入module到项目指定文件夹中:
1.在项目的根目录下创建文件夹(例如:third)
2.正常导入module,路径为根目录下
3.在文件管理中将导入的module的文件夹拖到third文件夹下
4.修改项目的setting.gradlesetting.gradle
例如:
include ':third:xrecyclerview'
- 导包完成之后运行报错:
Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class com.loyo.customermodule.fragment.CustomerFragment, unresolved supertypes: com.jcodecraeer.xrecyclerview.XRecyclerView.LoadingListener
场景:我有一个公共模块,一个客户模块和订单模块(都导入公共模块),我公共模块需要对xrecyclerview进行二次封装,客户模块和订单模块使用。
解决办法:把library模块的依赖包implementation改为api,因为implementation依赖的包只能在本模块使用,api依赖的包可供其它模块使用
例如:
在公共模块的build.gradle中导入,使其他模块可以使用
implementation project(':ThirdPartyLibrary:xrecyclerview')