公共UI
更新时间:2020-03-17
本SDK提供了下述几种自定义View,给开发中使用。
天气
- 构造函数
WeatherLayoutView(Context context) - 初始化函数
public void setWeatherLayoutView(WeatherInfoCard weatherInfoCard, int weight, int height);参数:
WeatherInfoCard weatherInfoCard:天气信息的实体类;
int weight:为天气布局展示区域的宽;
int height:为展示区域的高; - 实体类说明:
WeatherInfoCard:
| 参数名称 | 类型 | 详细说明 |
|---|---|---|
| city | String | 城市名,例如:“北京市” |
| time | String | 日期,例如:"周五 12月07日" |
| weatherInfo | List | 天气信息(WeatherInfo)数组 |
WeatherInfo:
| 参数名称 | 类型 | 详细说明 |
|---|---|---|
| type | String | 有Common、Detail两种;当天日期为 Detail 类型,其他日期为 Common 类型 |
| icon | String | 天气图标url |
| temp | String | 温度区间描述,例如"-10℃~-5℃" |
| time | String | 日期,例如:"周五 12月07日" |
| weather | String | 天气描述,例如“晴” |
| wind | String | 风向风力描述,例如“西北风微风” |
| pm25 | String | pm25参数,返回一个字符串格式的整数,例如“10”、“42” |
| pmLevel | String | 空气质量等级,例如“优”、“良好” |
| currentTemp | String | 当前温度,例如“-7℃"" |
卡片
- 构造函数
CardLayoutView(Context context) - 初始化函数
public void setCardLayoutViewBean(final NormalCardItem cardItem)
参数:
NormalCardItem cardItem:卡片信息的实体类; - 实体类说明:
| 参数名称 | 类型 | 详细说明 |
|---|---|---|
| title | String | 卡片标题 |
| imageUrl | String | 卡片图片url |
| content | String | 卡片内容 |
| url | String | 卡片外链url |
多图
- 构造函数
MultigraphView(@NonNull Context context) - 初始化函数
public void setMultigraph(ListCard listCard)
参数:
ListCard listCard:为多图卡片实体类; - 实体类说明:
ListCard
| 参数名称 | 类型 | 详细说明 |
|---|---|---|
| list | List | 卡片内容列表 |
SimpleImageCardItem
| 参数名称 | 类型 | 详细说明 |
|---|---|---|
| image | String | 图片链接 |
| url | String | 卡片外链url |
长文本
- 构造函数
TextLayoutview(Context context) - 初始化函数
setCardContent(TextCard textCard)
参数:
TextCard textCard**:为解析长文本json数据之后的实体类; - 实体类说明:
SimpleImageCardItem
| 参数名称 | 类型 | 详细说明 |
|---|---|---|
| content | String | 文本内容 |
| url | String | 卡片外链url |
评价此篇文章
