检测屏幕触摸是否正常,代码十分简单,亲测有效
super(context, attrs, defStyleAttr);
unSelectRect = new ArrayList();
selectRect = new ArrayList();
//获取屏幕的宽高
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
screenHeight = displayMetrics.heightPixels;
screenWidth = displayMetrics.widthPixels;
Log.e(TAG, " 屏幕尺寸:" + screenWidth + "x" + screenHeight);
paint = new Paint();
paint.setColor(Color.RED);
paint.setStyle(Paint.Style.STROKE);
// 抗锯齿
paint.setAntiAlias(true);
// 防抖动
paint.setDither(true);
paint2 = new Paint();
paint2.setColor(Color.GREEN);
paint2.setStyle(Paint.Style.FILL);
// 抗锯齿
paint2.setAntiAlias(true);
// 防抖动
paint2.setDither(true);
1