小编Ter*_*ETT的帖子

在旋转的画布上为图像添加触摸侦听器

所以我现在已经坚持了一个星期了...

我已经按照本教程:https: //code.tutsplus.com/tutorials/android-sdk-augmented-reality-camera-sensor-setup--mobile-7873

我在Canvas上动态绘制图像,然后通过旋转矩阵旋转,我从传感器获取.

我正在尝试做的是添加侦听器到我正在绘制和在画布上旋转的ImageView,但我无法想办法.

if (lastAccelerometer != null && lastCompass != null) {
    boolean gotRotation = SensorManager.getRotationMatrix(rotation,
            identity, lastAccelerometer, lastCompass);
    if (gotRotation) {
        float cameraRotation[] = new float[9];
        // remap such that the camera is pointing straight down the Y
        // axis
        SensorManager.remapCoordinateSystem(rotation,
                SensorManager.AXIS_X, SensorManager.AXIS_Z,
                cameraRotation);

        // orientation vector
        float orientation[] = new float[3];
        SensorManager.getOrientation(cameraRotation, orientation);

        // draw horizon line (a nice sanity check piece) and the target (if it's on the screen)
        canvas.save();
        // use roll …
Run Code Online (Sandbox Code Playgroud)

android canvas listener

7
推荐指数
0
解决办法
166
查看次数

标签 统计

android ×1

canvas ×1

listener ×1