首页 > 代码库 > ArcGIS for Android 10.1.1API 中文标注导致程序异常崩溃问题

ArcGIS for Android 10.1.1API 中文标注导致程序异常崩溃问题

1、前言

 

2、解决方案

 /**      * 文字转换BitMap      * @param text      * @return      */    public static Drawable createMapBitMap(String text) {        int size = 50;        int height = 60;        if(CommonValue.dpilevel==1){            size = 22;            height = 30;        }else if(CommonValue.dpilevel==2){            size = 50;            height = 60;        }                Paint paint = new Paint();        paint.setColor(Color.BLUE);        paint.setTextSize(size);        paint.setAntiAlias(true);        paint.setTextAlign(Align.LEFT);//位置        float textLength = paint.measureText(text);        int width = (int) textLength;                Bitmap newb = Bitmap.createBitmap(width*2, height*2, Config.ARGB_8888);        Canvas cv = new Canvas(newb);        cv.drawColor(Color.parseColor("#00000000"));        cv.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG                | Paint.FILTER_BITMAP_FLAG));        cv.drawText(text, width, size, paint);        cv.save(Canvas.ALL_SAVE_FLAG);// 保存        cv.restore();// 存储        return new BitmapDrawable(newb);    }

 

3、参考链接

http://blog.csdn.net/u014014578/article/details/36180485

ArcGIS for Android 10.1.1API 中文标注导致程序异常崩溃问题