Customize SurfaceView to realize drawing board and canvas through Canvas, Path and Paint

Here are three methods of withdraw, restore, and clear, here is the complete code + comment import android.annotation.SuppressLint; import android. content. Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android. graphics. Color; import android. graphics. Paint; import android.graphics.Path; import android.graphics.PixelFormat; import android.graphics.PorterDuff; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; import androidx.annotation.NonNull; import com.greenleaf.tools.BaseLog; import com.greenleaf.tools.BaseTools; import […]

Android uses SurfaceView to implement signature pad

SurfaceView uses First create a SurfaceViewSign class, inherit the SurfaceView class, inherit the SurfaceHolder.Callback and Runnable interfaces, the code is as follows: import android. content. Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android. graphics. Color; import android. graphics. Paint; import android.graphics.Path; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; ? public class SurfaceViewSign extends SurfaceView implements […]

The difference between SurfaceView and ordinary view

Introduce some important points that you think are important on the basis of bloggers Then there is a knowledge point to be corrected based on your own understanding (with strikethrough), let’s discuss together: ————The following is the difference between reproduced SurfaceView and ordinary view and its simple use_lidongxiu0714’s blog-CSDN blog 1 Introduction to SurfaceView The […]

[Solved] Android SurfaceView preview deformation perfect solution

This question has been searched a lot on Baidu. Basically, it means to find a camera preview size with a similar ratio to SurfaceView, but it is still a little bit meaningless when it is found that the preview is a little bit meaningless. See the callback below to know why. @Override public void surfaceChanged(SurfaceHolder […]