Canvas Drawtext Positioning
I am creating a drawing tool, where user add text to image. While making the text draw to bitmap via canvas position is not being set properly. Paint paint = new Paint();
Solution 1:
Got the solution. the values should be pixel independent convert xPos and yPos as below before passing to drawText
xPos = (int) (xPos / getResources().getDisplayMetrics().density);yPos = (int) (yPos / getResources().getDisplayMetrics().density);
Solution 2:
Its even better to use Drawing cache and save that to any file location. In this case we dont have to much bother about positioning. Wrap all in one layout and get the
view.getDrawingCache()
Post a Comment for "Canvas Drawtext Positioning"