All Projects → CCY0122 → miuiweatherline

CCY0122 / miuiweatherline

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

Programming Languages

java
68154 projects - #9 most used programming language

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、天气类型等)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].