Skip to content

仿小米MIUI天气24小时天气预测折线图控件

Notifications You must be signed in to change notification settings

CCY0122/miuiweatherline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

miuiweatherline

仿小米MIUI8天气24小时预报折线图控件
源码解析博客地址
http://blog.csdn.net/ccy0122/article/details/76464825

效果预览

image1 image2

使用方法

xml:

    <com.example.ccy.miuiweatherline.MiuiWeatherView
        android:id="@+id/weather"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:line_interval="60dp" (可选,相邻点距离)
        app:min_point_height="60dp"  (可选,折线最低高度)
        app:background_color="#ffffff"/>  (可选,背景色)


code:
使用com.example.ccy.miuiweatherline.WeatherBean作为元数据:

weatherView = (MiuiWeatherView) findViewById(R.id.weather);
 List<WeatherBean> data = new ArrayList<>();
 //add your WeatherBean to data
 WeatherBean b1 = new WeatherBean(WeatherBean.SUN,20,"05:00");
 WeatherBean b2 = new WeatherBean(WeatherBean.RAIN,22,"日出","05:30");
 //b3、b4...bn
 data.add(b1);
 data.add(b2);
 weatherView.setData(data);

(代码很少,建议直接copy,因为大家应该大概率会去修改/增加源码的天气icon、天气类型等)

About

仿小米MIUI天气24小时天气预测折线图控件

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages