2014-12-26 5 views
1

와 제목 글꼴을 변경하려면 나는이 TextDrawer 클래스에서 시도하지만어떻게 ShowcaseView 안드로이드 도서관

try { titleTypeface = Typeface.createFromAsset(context.getAssets(), "Face Your Fears.ttf"); 

} catch (Exception e) { 
// Pretend that never happened, and use the default font 
Log.d(TAG, "TITLE FONT: "); 
Log.d(TAG, "default font"); 
} 
titlePaint.setTypeface(titleTypeface); 
textPaint.setTypeface(titleTypeface); 

어떤 제안을 작동하지?

답변

2

내 TextDrawer 생성자는 나를

public TextDrawer(Resources resources, ShowcaseAreaCalculator calculator, Context context) { 
    padding = resources.getDimension(R.dimen.text_padding); 
    actionBarOffset = resources.getDimension(R.dimen.action_bar_offset); 

    this.calculator = calculator; 
    this.context = context; 

    String fontPath = "fonts/SuperAwesomeFont.ttf"; 
    Typeface mTypeFace = Typeface.createFromAsset(context.getAssets(),fontPath); 

    titlePaint = new TextPaint(); 
    titlePaint.setAntiAlias(true); 
    titlePaint.setTypeface(mTypeFace); 

    textPaint = new TextPaint(); 
    textPaint.setAntiAlias(true); 
    textPaint.setTypeface(mTypeFace); 
} 
+0

야 작동 다음과 같이 보인다. 그것은 나를 위해 또한 일했다. 내 코드의 버그는 스타일 파일에서 서체로 서체를 변경했기 때문에 코드의 서체 설정이 작동하지 않았습니다. – bpr10