小编Sha*_*ana的帖子

ACTION_MOVE上的图像视图旋转

我可以在ACTION_DOWN上旋转图像视图.

但它不适用于ACTION_MOVE和ACTION_UP.

public class RotateImage extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Rotate rotate;
        rotate = new Rotate(this);

        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
            requestWindowFeature(Window.FEATURE_NO_TITLE);

        setContentView(rotate);
    }
}

public class Rotate extends ImageView {
    Paint paint;
    int direction = 0;
    private float x;
    private float y;
    int degree = 0;
    float a, b, c;
    private float centerX ;
    private float centerY ;
    private float newX ;
    private float newY ;

    public Rotate(Context …
Run Code Online (Sandbox Code Playgroud)

android

2
推荐指数
1
解决办法
2011
查看次数

标签 统计

android ×1