Android快速生成通用Adapter

快速开始

Android Studio - 在build.gradle中引入

//必选
compile 'com.dyhdyh.adapters:adapters:1.0.0'
//如果需要支持DataBinding(可选)
compile 'com.dyhdyh.adapters:adapters-databinding:1.0.0'
  • 1
  • 2
  • 3
  • 4

需要的依赖

compile 'com.android.support:recyclerview-v7:24.2.1'
  • 1


模板安装

1.下载打包好的templates或者找到源码中的templates文件夹


2.将templates文件夹里的adapters整个复制到AndroidStudio模板目录下

Windows:D:\android-studio\plugins\android\lib\templates

Mac:/Applications/Android Studio.app/Contents/plugins/android/lib/templates 



3.重启Android Studio 

快速生成




生成出来的代码

体力活都自动做好了,我们要写的就只有绑定数据了




RecyclerView和ListView的相互转换

当需要将RecyclerAdapter转成ListAdapter的时候,把这两个类名改一下就可以了




猜你喜欢

转载自blog.csdn.net/sqq_yj/article/details/80450683
今日推荐