从右到左的Android画布上的drawText
我有一个应用程序HANDELS阿拉伯语太多,但我的阿拉伯语用户有一个问题,即的drawText翻转字..阿拉伯必须由右至左。如何使右画布的drawText向左?
I have an app that handels Arabic too, but my Arabic users have a problem that the drawText flip the word .. Arabic must be from right to left. How do I make the canvas drawText from right to left?
图中看到突出显示的文本是正确的文本的一个TextView和它的罚款。但是,在画布的drawText一个在一个圆是错误的。它必须是由右至左,如何让我的画布上的drawText从右到左?
See in the picture the highlighted text is the right text its a textView and it's fine. But the canvas DrawText the one in a circle is wrong. It must be from right to left, how do I make the canvas drawText from right to left?
在画布只是创建两边两点要绘制文本,然后创建它们之间的路径。使用这种方法,它会正常工作
On the canvas just create two points on sides where you want to draw text, and then create path between them. use this method it will work fine
Path path = new Path();
Paint paint = new Paint();
path.moveTo(p2.x, p2.y);
path.lineTo(p1.x, p1.y);
canvas.drawTextOnPath(String.valueOf(txt), path, (float) (c.getWidth() / (2.3)), (float) (c.getHeight()/2 + paint.getTextSize()/1.5), paint);