gpt4 book ai didi

android - 如何使用 ShowcaseView android 库更改标题字体

转载 作者:行者123 更新时间:2023-11-29 20:56:13 27 4
gpt4 key购买 nike

我在 TextDrawer 类中尝试过,但它不起作用

  try {  titleTypeface = Typeface.createFromAsset(context.getAssets(), "Face Your Fears.ttf");

} catch (Exception e) {
// Pretend that never happened, and use the default font
Log.d(TAG, "TITLE FONT: ");
Log.d(TAG, "default font");
}
titlePaint.setTypeface(titleTypeface);
textPaint.setTypeface(titleTypeface);

有什么建议吗?

最佳答案

我的 TextDrawer 构造函数如下所示,对我有用

public TextDrawer(Resources resources, ShowcaseAreaCalculator calculator, Context context) {
padding = resources.getDimension(R.dimen.text_padding);
actionBarOffset = resources.getDimension(R.dimen.action_bar_offset);

this.calculator = calculator;
this.context = context;

String fontPath = "fonts/SuperAwesomeFont.ttf";
Typeface mTypeFace = Typeface.createFromAsset(context.getAssets(),fontPath);

titlePaint = new TextPaint();
titlePaint.setAntiAlias(true);
titlePaint.setTypeface(mTypeFace);

textPaint = new TextPaint();
textPaint.setAntiAlias(true);
textPaint.setTypeface(mTypeFace);
}

关于android - 如何使用 ShowcaseView android 库更改标题字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27654017/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com