package com.hfengxiang.example.myphotoview; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.View; /** * Created by cquxcm on 2016/6/20. */ public class RotateView extends View { private static final double MAX_ANGLE = 1e-1; private Paint mPaint; private float mRotation; private Float mPreviousAngle; public RotateView(Context context) { super(context); Log.d("xcm", "constructor 1"); } public RotateView(Context context, AttributeSet attrs) { super(context, attrs); Log.d("xcm", "constructor 2"); } public RotateView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); Log.d("xcm", "constructor 3"); } @
连续旋转角度
最新推荐文章于 2024-09-28 14:06:20 发布
该博客展示了如何在Android中创建一个自定义View,通过双指触控实现视图的连续旋转。作者利用MotionEvent事件处理双指滑动,计算角度差,并通过Canvas的rotate方法更新视图的旋转角度。
摘要由CSDN通过智能技术生成