2013年9月5日星期四

Class inherits from View, on the canvas drawtext, ability to use external fonts ?

Now in the Activity class TextView class to use external fonts to download , as follows:

tv1 = (TextView) findViewById(R.id.textView1);
Typeface typeFace = Typeface.createFromAsset(getAssets(),"fonts/YOUNGATHEART.ttf");
tv1.setTypeface(typeFace);


The problem is that now there is an inheritance View Activity class with mTextUtil.DrawText (canvas); TextDraw drawn to a string , the string on how to download to the use of external fonts.
( I hope it clear , ask for advice , thank you )
------ Solution -------------------------- ------------------
Typeface typeFace = Typeface.createFromAsset (getContext (). getAssets (), "fonts / YOUNGATHEART.ttf" ) ;
paint.setTypeface (typeFace);
canvas.drawText ("", 0, 0, paint);
properly properly
------ For reference only ------------------------------- --------
onlookers learning

没有评论:

发表评论