创建Activity去加载自定义布局
LineView
public class LineView extends View {
private String[] timeArr={
"00:00","06:00","12:00","18:00","24:00"
};
//温度值
private String[] arr={
"-20°","-10°","0°","10°","20°","30°","40°"
};
private Paint mPaint;
private float margin=60;
private Path mPath;
public LineView(Context context) {
super(context);
init(context);
}
public LineView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public LineView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
// 初始化
private void init(Context context) {
mPath=new Path();
setBackgroundColor(Color.parseColor("#2222