所以我现在已经坚持了一个星期了...
我已经按照本教程: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)