一、效果图
二、实现步骤
1.添加依赖库
compile 'com.github.lecho:hellocharts-android:v1.5.8'
2.布局文件
<?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">
<include
android:id="@+id/include_id"
layout="@layout/titlelayout_theme"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="4dp"
android:orientation="horizontal">
<View
android:layout_width="6dp"
android:layout_height="6dp"
android:background="#BF0815" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10sp"
android:text="噪音"
android:layout_marginLeft="5dp"
android:textColor="@color/common_gray3"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="4dp"
android:orientation="horizontal">
<View
android:layout_width="6dp"
android:layout_height="6dp"
android:background="#088B05" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10sp"
android:text="温度"
android:layout_marginLeft="5dp"
android:textColor="@color/common_gray3"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="4dp"
android:orientation="horizontal">
<View
android:layout_width="6dp"
android:layout_height="6dp"
android:background="#0862D8" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10sp"
android:text="pm2.5"
android:layout_marginLeft="5dp"
android:textColor="@color/common_gray3"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="4dp"
android:orientation="horizontal">
<View
android:layout_width="6dp"
android:layout_height="6dp"
android:background="#552705" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10sp"
android:text="风速"
android:layout_marginLeft="5dp"
android:textColor="@color/common_gray3"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding=

本文档详细介绍了如何在Android应用中利用HelloChart库来绘制多条折线图。从展示效果图开始,接着说明了添加HelloChart库的依赖、配置布局文件以及在Activity类中实现绘图的步骤。
最低0.47元/天 解锁文章
3151

被折叠的 条评论
为什么被折叠?



