0

我需要TextSymbol在 android 中设置阿拉伯语文本。这是我的代码

TextSymbol txtSymbol = new TextSymbol(24, "مرحبا", Color.BLUE);
Point pt = new Point(-293826, 7574114);
Graphic gr = new Graphic(pt, txtSymbol);
GraphicsLayer gl = new GraphicsLayer();
mMapView.addLayer(gl);
gl.addGraphic(gr);

注意:有方法setFontFamily(),我尝试了一些字体,但不起作用。问题是从右到左方向的语言,如阿拉伯语、希伯来语等。

4

1 回答 1

0

请尝试这种方式将阿拉伯文本转换为 UTF-8

   String input = "مرحبا";
   String arabicString= new String (input.getBytes("UTF8")); 

    TextSymbol txtSymbol = new TextSymbol(24, arabicString, Color.BLUE);
    Point pt = new Point(-293826, 7574114);
    Graphic gr = new Graphic(pt, txtSymbol);
    GraphicsLayer gl = new GraphicsLayer();
    mMapView.addLayer(gl);
    gl.addGraphic(gr);
于 2018-10-10T07:26:53.147 回答