package com.example.wireframe;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Paint.Style;
import android.graphics.RectF;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewTreeObserver.OnPreDrawListener;
/**
* 圆弧计分
* @author Administrator
*/
public class HomeArc extends View {
private Paint paint_black, paint_white;
private RectF rectf;
private float tb;
private int blackColor = 0x70000000; // 底黑色
private int whiteColor = 0xddffffff; // 白色
private int score;
private float arc_y = 0f;
private int score_text;
public HomeArc(Context context, int score) {
super(context);
init(score);
}
public void init(int score) {
this.score = score;
Resources res = getResources();
tb = res.getDimension(R.dimen.history
android 中使用Canvas 画圆
最新推荐文章于 2024-09-08 14:20:02 发布
这篇博客介绍了如何在Android应用中使用Canvas来绘制圆弧。通过LinearLayout的arc实例,添加了一个名为HomeArc的自定义视图,该视图在构造函数中接收上下文参数和圆弧的半径值88。
摘要由CSDN通过智能技术生成