我需要在Android的TextSymbol
中设置阿拉伯文字。这是我的代码
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()
,我尝试使用某些字体,但不起作用。问题是从右向左的定向语言,例如阿拉伯语,希伯来语等。
答案 0 :(得分: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);