Android学习之天气预报简单版
2015-06-27 17:16
555 查看
自己想做一个简单的天气预报,由于能力有限,暂时做个简单的。
大概讲一下自己的开发步骤吧。
第一步:获得可以开发的json数据的及时更新的接口。
通过强大的度娘,我这里使用的json的地址是:http://wthrcdn.etouch.cn/weather_mini?citykey=101010100
第二步:实现各大城市编号的获取
实现方法:网上下载一个包含各大城市的db文件db_weather.db,下载地址:http://pan.baidu.com/s/1hqkxlxM
这个db文件里面包含中国各大省份及城市编号,里面的大概内容截图如下所示
这个是省份表:
View Code
到此,这个简单的天气程序基本上结束了。
整个项目需要下载,在此给出项目下载地址:http://pan.baidu.com/s/1gd3wcqJ
有什么问题尽管提出
大概讲一下自己的开发步骤吧。
第一步:获得可以开发的json数据的及时更新的接口。
通过强大的度娘,我这里使用的json的地址是:http://wthrcdn.etouch.cn/weather_mini?citykey=101010100
第二步:实现各大城市编号的获取
实现方法:网上下载一个包含各大城市的db文件db_weather.db,下载地址:http://pan.baidu.com/s/1hqkxlxM
这个db文件里面包含中国各大省份及城市编号,里面的大概内容截图如下所示
这个是省份表:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:id="@+id/tvCity" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:textSize="28sp"/> <View android:layout_width="fill_parent" android:layout_height="2dip" android:background="#FF0000ff"/> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/tvWendu" android:layout_weight="1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" android:textSize="25sp"/> <TextView android:id="@+id/tvWenduValue" android:layout_weight="2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" android:textSize="25sp"/> </LinearLayout> <View android:layout_width="fill_parent" android:layout_height="2dip" android:background="#FFff0099"/> <TextView android:id="@+id/tvCurrentWendu" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:textSize="25sp"/> <View android:layout_width="fill_parent" android:layout_height="2dip" android:background="#FFff9999"/> <TextView android:id="@+id/tvNote" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:textSize="25sp"/> <View android:layout_width="fill_parent" android:layout_height="2dip" android:background="#FF00ff99"/> <TextView android:id="@+id/tvCurrentCity" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:textSize="25sp"/> <View android:layout_width="fill_parent" android:layout_height="2dip" android:background="#FF001155"/> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/tvTomWendu" android:layout_weight="1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" android:textSize="25sp"/> <TextView android:id="@+id/tvTomWenduValue" android:layout_weight="2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" android:textSize="25sp"/> </LinearLayout> <View android:layout_width="fill_parent" android:layout_height="0.5dip" android:background="#FF001100"/> <TextView android:id="@+id/tvTodayType" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:textSize="25sp"/> <View android:layout_width="fill_parent" android:layout_height="0.5dip" android:background="#FF008800"/> <TextView android:id="@+id/tvTomorrowType" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="" android:textSize="25sp"/> </LinearLayout>
View Code
到此,这个简单的天气程序基本上结束了。
整个项目需要下载,在此给出项目下载地址:http://pan.baidu.com/s/1gd3wcqJ
有什么问题尽管提出
相关文章推荐
- Android---61---TabHost简单使用
- Android中数据库的操作流程详细解释
- Android Xposed框架出现java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation问题
- Android高通平台调试Camera驱动全纪录
- Android高通平台调试Camera驱动全纪录
- 高通 android平台LCD驱动分析
- 高通 android平台LCD驱动分析
- android JBOX2D粒子碰撞的实例,以达到特殊效果
- 在android中做一个竖着的seekbar效果
- Android Dialog使用举例
- 国内如何下载 Android source code
- Android APK 签名比对详解
- Android中摇一摇效果的实现
- android 开源框架Universal-Image-Loader解析
- Android Chronometer(定时器)
- android快速开发--常用utils类
- Android实现ButterKnife
- Android屏幕适配全攻略(最权威的官方适配指导)
- android 倒计时控件
- Android按钮点击监听事件的写法