I want to draw text in Canvas. using this code:
canvas.drawText(getString(R.string.test1)+c, 30,320, paint);
a need change of "c" to bold...
Thanks...
I want to draw text in Canvas. using this code:
canvas.drawText(getString(R.string.test1)+c, 30,320, paint);
a need change of "c" to bold...
Thanks...
the class Paint
has method setTypeface
, you can pass a Typeface
.
code exmaple:
paint.setTypeface(Typeface.DEFAULT_BOLD);
so if you want change part of text, can draw one by one through change the typeface.
also, you can try use html code like <b>c</b>
Canvas.drawText and its various variants do all expect either a String
, CharSequence
or char[]
. All those types do not support Spannable or Stylable objects. Short: It's not possible in the way you want.
You probably can try to implement the suggesstions idiottiger
posted.