0
fontawesome에서 아이콘을 android의 알림보기로 그립니다. 이렇게하려면이 아이콘을 비트 맵에 그려서 서체를 설정 한 다음 알림보기에서 비트 맵을 설정하려고했습니다.fontawesome을 비트 맵으로 그립니다.
나는이 코드를 사용합니다
Bitmap myBitmap = Bitmap.createBitmap(100, 50, Bitmap.Config.ARGB_8888);
Canvas myCanvas = new Canvas(myBitmap);
Paint paint = new Paint();
Typeface typeface = Typeface.createFromAsset(getApplicationContext().getAssets(),"fonts/fontawesome-webfont.ttf");
paint.setAntiAlias(true);
paint.setSubpixelText(true);
paint.setTypeface(typeface);
paint.setStyle(Paint.Style.FILL);
paint.setColor(Color.WHITE);
paint.setTextSize(15);
myCanvas.drawText("", 0, 20, paint);
notificationView.setImageViewBitmap(R.id.activity, myBitmap);
을하지만 보여줍니다 모든 ""
(아이콘 없음)입니다. 다른 문맥에서 폰트 팜은 잘 작동합니다.
'drawText()'는 독자적으로 HTML 스타일의 엔티티 참조를 변환하지 않습니다. – CommonsWare
좋아, 내가 제대로 작동하도록하기 위해 내가 무엇을 바꿀 수 있는지 생각해? – ksome
''\ u "'표기법을 시도하십시오 : http://stackoverflow.com/a/8062048/115145 http://javajee.com/unicode-escapes-in-java – CommonsWare