带阴影的圆形 — CircleShadow
避坑:关闭硬件加速,否则没有阴影的效果
package com.baina.mydemo.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import com.baina.mydemo.R;
import androidx.annotation.Nullable;
/**
* @ClassName CircleShadow
* @Description 带阴影的圆形
* 阴影半径 + 中心圆半径 = view的最小边长度
* 需要关闭硬件加速,否阴影显示不出来
* @Author {Bai Jiansong}
* @Date 2022/4/30 20:20
* @Version 1.0
*/
public class CircleShadow extends View {
private static final String TAG = "JPush";
private float shadowRadius = 10;
private Context context;
private Paint paint = new Paint();
public CircleShadow(Context context) {
this(context, null);
}
publ