自定义控件Android 开发技术分享androidCHART

使用Retrofit+Rxjava+MPAndroid来显示气温

2017-03-16  本文已影响364人  Ugly_K

使用Retrofit+Rxjava+MPAndroid来显示气温曲线图

这里是抓包抓来API接口:http://aider.meizu.com/app/weather/listWeather?cityIds=101020600

先看一下最终的结果:

好吧,下面就正式开始项目吧~

1.导入第三方库

//okhttp
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.squareup.okio:okio:1.11.0'
compile 
//butterknife
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
//Rxjava
compile 'io.reactivex:rxjava:1.1.3'
compile 'io.reactivex:rxandroid:1.1.0'
//Retrofit
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.retrofit2:converter-scalars:2.0.2'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
//gson
compile files('libs/gson-2.6.2.jar')
//MPAndroid
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'

2.初始化设置

很简单,一个标题,一个按钮,一个折线图

3.逻辑编写

4.监听者主线程更新UI

5.查看源码

一起进步吧,少年~
点击这里查看源码

上一篇下一篇

猜你喜欢

热点阅读