2014-10-30 3 views
1

TextAppearance으로 텍스트를 그리는 방법은 무엇입니까?특정 텍스트 모양으로 텍스트 그리기

여기 내 코드입니다.

Paint paint = new Paint(); 
    paint.setAntiAlias(true); 
    paint.setColor(Color.WHITE); 
    paint.setFakeBoldText(false); 
    paint.setTextSize(textSize); 
    // TODO: set the style of the text to a specific TextAppearance. E.g. @android:style/TextAppearance.DeviceDefault.Large.Inverse 
    canvas.drawText(context.getResources().getString(R.string.myString), textOffsetX, textOffsetY, paint); 

나는 TypeFace 개체를 살펴 보았다,하지만 난 TextAppearance에서 서체를 만드는 방법을 모르겠습니다.

답변

2

동료가 나에게 TextAppearance

TextView textView = new TextView(context); 
textView.setTextAppearance(context, android.R.style.TextAppearance.DeviceDefault.Large); 
paint.setColor(textView.getCurrentTextColor()); 
paint.setTextSize(textView.getTextSize()); 
paint.setTypeface(textView.getTypeface()); 
의 다리로 TextView를 사용하는 솔루션을 준