静的レイアウトのテキストを太字にする方法はありますか? 次のコードを使用して StaticLayout を使用してテキストを設定するように、1 つの政府文書を印刷しようとしていますCanvas
。
TextPaint mTextPaint=new TextPaint();
mTextPaint.setTypeface(Typeface.createFromAsset(context.getAssets(),"fonts/times.ttf"));
StaticLayout mTextLayout;
canvas.save();
mTextLayout = new StaticLayout(getText(), mTextPaint, pageInfo.getPageWidth()/2-otherPadding*3, Layout.Alignment.ALIGN_NORMAL, 1.0f, 1.0f, true);
translate(textX, textY);
draw(canvas);
....
WheregetText()
メソッドは、以下のように印刷したい文字列を返します。
String getText()
{
return "Name and complete address of Genetic Clinic/Ultrasound Clinic/Imaging centre : "+hospital.getName();
}
ここでは、病院名のみを太字にしたいと思います。