sreang rathanak
sreang rathanak

Reputation: 532

Apply Style on Canvas Text

I try to use canvas to draw text in Android, but I want to put more style on it, and don't know how. Please help.

void onDraw(Canvas cn){
    Paint myP=new Paint();
    myP.setTextSize((float) (12*Main.screenH));
    cn.drawText(qty + "paper = " + qty * money.getMonType().qty
            + "amount", (int)(340*Main.screenW),(int)(80*Main.screenH), myP);
}

Upvotes: 0

Views: 59

Answers (1)

GIGAMOLE
GIGAMOLE

Reputation: 1266

U must use the functions of Paint for more customizations:

Paint paint = new Paint();
paint.setColor(Color.GREEN);
paint.setTextSize(40);
Typeface chops = Typeface.createFromAsset(getAssets(),
    "ChopinScript.ttf");
paint.setTypeface(chops);

Upvotes: 1

Related Questions