前言
几个月前写了篇使用 RecyclerView 的简单介绍:【Android 基础】RecyclerView 概述以及使用步骤
现在结合 ButterKnife+Retrofit+Picasso+RecycleView 实现一个小案例。关于 Retrofit、Picasso、ButterKnife 的详细使用请看我之前写的文章
【Android 进阶】Retrofit2 目前最优雅的网络请求框架
build.gradle 文件
apply plugin: 'android-apt'
.
.
.
//butterknife
compile 'com.jakewharton:butterknife:8.4.0'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
//retrofit
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
// okHttp
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
//picasso
compile 'com.squareup.picasso:picasso:2.5.2'
数据接口
// Callback 类型为自定义的 javaBean
public interface ApiService {
public static final String BASE_URL = "http://112.xxx.22.238:8081/course_api/xxxplay/";
@GET("featured")