天气开发1——第二行代码(酷欧天气)

前言:
首先我要感谢郭霖大神。郭霖大神的《第一行代码》、《第二行代码》可谓我的启蒙书。这几天特地把酷欧天气实现一遍,感受颇深。
以下为酷欧天气开发笔记,其涉及到的开源框架有:

  1. litepal(数据库操作)
  2. okhttp (网络传输)
  3. butterknife(简化findViewById,简化代码)
  4. glide(图片加载)
  5. gson(解析Json)

一共有四篇,代码下载链接在第四篇中:
天气开发1——第二行代码(酷欧天气)
天气开发2——第二行代码(酷欧天气)
天气开发3——第二行代码(酷欧天气)
天气开发4——第二行代码(酷欧天气)

效果图:
这里写图片描述

这里写图片描述

添加依赖库

    compile 'org.litepal.android:core:1.3.2'
    compile 'com.squareup.okhttp3:okhttp:3.6.0'
    compile 'com.google.code.gson:gson:2.7'
    compile'com.github.bumptech.glide:glide:3.7.0'

butterknife会有所不同:

在 app build.gradle中下载

dependencies {
  compile 'com.jakewharton:butterknife:8.6.0'
  annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
}

在root build.gradle 根目录中添加

buildscript {
  repositories {
    mavenCentral()
   }
  dependencies {
    classpath 'com.jakewharton:butterknife-gradle-plugin:8.6.0'
  }
}

最后回到app build.gradle中

apply plugin: 'com.jakewharton.butterknife'

litepal使用

在Manifest中声明:

<application
        android:name=
  • 3
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值