源码
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;import androidx.annotation.Nullable;public class VideoBrightness extends View {private Paint paint;private int solid = Color.CYAN;private float cx;private float cy;private float radius = 50;private float diameter = 100;private int gap = 20;private float lineLength = 25;private float lineWidth = 5;public VideoBrightness(Context context) {this(context, null);}public VideoBrightness(Context context, @Nullable AttributeSet attrs) {this(context, attrs, 0);}public VideoBrightness(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);paint = new Paint();paint.setAntiAlias(true);paint.setColor(solid);}@Overrideprotected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {super.onMeasure(widthMeasureSpec, heightMeasureSpec);cx = getMeasuredWidth() / 2;cy = getMeasuredHeight() / 2;diameter = Math.min(getMeasuredHeight(), getMeasuredWidth());radius = diameter / 6;lineLength = diameter / 12 - gap;}@Overrideprotected void onDraw(Canvas canvas) {super.onDraw(canvas);paint.setStyle(Paint.Style.FILL);canvas.drawCircle(cx, cy, radius, paint);paint.setStyle(Paint.Style.STROKE);paint.setStrokeWidth(lineWidth);paint.setStrokeCap(Paint.Cap.ROUND);float length = radius + gap;for (int angle = 0; angle < 360; angle += 45) {double radians = Math.toRadians(angle);float startX = cx + (float) (length * Math.cos(radians));float startY = cy + (float) (length * Math.sin(radians));float endX = cx + (float) ((length + lineLength) * Math.cos(radians));float endY = cy + (float) ((length + lineLength) * Math.sin(radians));canvas.drawLine(startX, startY, endX, endY, paint);}}}