Android 天气APP(十一)未来七天的天气预报、逐小时预报、UI优化

weatherStateIcon.setBackgroundResource(R.mipmap.icon_201);

break;

case 205://强风/劲风

case 206://疾风

case 207://大风

weatherStateIcon.setBackgroundResource(R.mipmap.icon_205);//因为这几个状态的图标是一样的

break;

case 208://烈风

case 209://风暴

case 210://狂爆风

case 211://飓风

case 212://龙卷风

case 213://热带风暴

weatherStateIcon.setBackgroundResource(R.mipmap.icon_208);//因为这几个状态的图标是一样的

break;

case 300://阵雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_300);

break;

case 301://强阵雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_301);

break;

case 302://雷阵雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_302);

break;

case 303://强雷阵雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_303);

break;

case 304://雷阵雨伴有冰雹

weatherStateIcon.setBackgroundResource(R.mipmap.icon_304);

break;

case 305://小雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_305);

break;

case 306://中雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_306);

break;

case 307://大雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_307);

break;

case 308://极端降雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_312);

break;

case 309://毛毛雨/细雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_309);

break;

case 310://暴雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_310);

break;

case 311://大暴雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_311);

break;

case 312://特大暴雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_312);

break;

case 313://冻雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_313);

break;

case 314://小到中雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_306);

break;

case 315://中到大雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_307);

break;

case 316://大到暴雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_310);

break;

case 317://大暴雨到特大暴雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_312);

break;

case 399://雨

weatherStateIcon.setBackgroundResource(R.mipmap.icon_399);

break;

case 400://小雪

weatherStateIcon.setBackgroundResource(R.mipmap.icon_400);

break;

case 401://中雪

weatherStateIcon.setBackgroundResource(R.mipmap.icon_401);

break;

case 402://大雪

weatherStateIcon.setBackgroundResource(R.mipmap.icon_402);

break;

case 403://暴雪

weatherStateIcon.setBackgroundResource(R.mipmap.icon_403);

break;

case 404://雨夹雪

weatherStateIcon.setBackgroundResource(R.mipmap.icon_404);

break;

case 405://雨雪天气

weatherStateIcon.setBackgroundResource(R.mipmap.icon_405);

break;

case 406://阵雨夹雪

weatherStateIcon.setBackgroundResource(R.mipmap.icon_406);

break;

case 407://阵雪

weatherStateIcon.setBackgroundResource(R.mipmap.icon_407);

break;

case 408://小到中雪

weatherStateIcon.setBackgroundResource(R.mipmap.icon_408);

break;

case 409://中到大雪

weatherStateIcon.setBackgroundResource(R.mipmap.icon_409);

break;

case 410://大到暴雪

weatherStateIcon.setBackgroundResource(R.mipmap.icon_410);

break;

case 499://雪

weatherStateIcon.setBackgroundResource(R.mipmap.icon_499);

break;

case 500://薄雾

weatherStateIcon.setBackgroundResource(R.mipmap.icon_500);

break;

case 501://雾

weatherStateIcon.setBackgroundResource(R.mipmap.icon_501);

break;

case 502://霾

weatherStateIcon.setBackgroundResource(R.mipmap.icon_502);

break;

case 503://扬沙

weatherStateIcon.setBackgroundResource(R.mipmap.icon_503);

break;

case 504://扬沙

weatherStateIcon.setBackgroundResource(R.mipmap.icon_504);

break;

case 507://沙尘暴

weatherStateIcon.setBackgroundResource(R.mipmap.icon_507);

break;

case 508://强沙尘暴

weatherStateIcon.setBackgroundResource(R.mipmap.icon_508);

break;

case 509://浓雾

case 510://强浓雾

case 514://大雾

case 515://特强浓雾

weatherStateIcon.setBackgroundResource(R.mipmap.icon_509);

break;

case 511://中度霾

weatherStateIcon.setBackgroundResource(R.mipmap.icon_511);

break;

case 512://重度霾

weatherStateIcon.setBackgroundResource(R.mipmap.icon_512);

break;

case 513://严重霾

weatherStateIcon.setBackgroundResource(R.mipmap.icon_513);

break;

case 900://热

weatherStateIcon.setBackgroundResource(R.mipmap.icon_900);

break;

case 901://冷

weatherStateIcon.setBackgroundResource(R.mipmap.icon_901);

break;

case 999://未知

weatherStateIcon.setBackgroundResource(R.mipmap.icon_999);

break;

}

}

}

WeatherForecastAdapter.java中做判断显示图标,代码如下:

package com.llw.goodweather.adapter;

import android.widget.ImageView;

import androidx.annotatio

  • 14
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值