9

Canvas Rotation plus onTouchEvent method

view full story
linux-howto

http://stackoverflow.com – I have created a bar graph using an inflated canvas. The problem is that it is upside down. I can flip it using the following code in the onDraw method, but it messes up the onTouchEvent method: public void onDraw(final Canvas canvas) { int width = super.getWidth(); int height = super.getHeight(); canvas.scale(1f, -1f, width * 0.5f, height * 0.5f); //more code after that... } The problem in the onTouchEvent is that it is recognizing where the bars where before the canvas was flipped. You can see what happens when I click where the original location was in the photo below (HowTos)