I have a Canvas and a Bitmap.I have to draw bitmap twice on canvas and rotate them.This is my code:
Bitmap bitmap = ... ;
Matrix matrix = new Matrix();
Camera camera = new Camera();
camera.save();
// First drawing:
camera.rotateX(x_rotate_angle);
camera.rotateY(y_rotate_angle);
camera.getMatrix(matrix);
matrix.postTranslate(0, 0);
matrix.postScale(3, 3);
canvas.drawBitmap(bitmap, matrix, null);
camera.restore();
// Second drawing:
camera.rotateX(x_rotate_angle);
camera.rotateY(y_rotate_angle);
camera.getMatrix(matrix);
matrix.postTranslate(10, 10 + bitmap.getHeight());
matrix.postScale(3, 3);
canvas.drawBitmap(bitmap, matrix, null);
Result before rotation:

When bitmaps rotate only axis X,all things are fine.In this case result looks like this:

In both above images you can see that all edges are parallel.But when bitmaps rotate axis Y,edges will not be parallel(bottom edge of top bitmap crosses top edge of bottom bitmap):

Did I do any thing wrong?
You’re not doing anything wrong, it’s just that you haven’t understood the results you were going to get from your code. The camera you’re using is a 3D camera and you’re seeing the results of moving the camera in 3D space. When you rotate a camera, parallel lines do not in general remain parallel. You noticed the artifact when rotating about the y-axis, but it’s also present in your illustration for the x-axis rotation. Notice that for the x-axis, the left and right sides are not parallel; the left side is closer to vertical than the right.
The Android
canvasobject has scale, skew, translate, and rotate operations. If it’s 2D operations that you need, you can ditch thecameraobject entirely.