如何在 Android Web 应用程序中使用非默认字体?

发布于 2025-01-06 13:09:50 字数 157 浏览 4 评论 0原文

我正在为 Android 操作系统开发移动网络应用程序。在这里,我的要求是使用“Thoma”字体,这不是桌面浏览器和Android SDK webkit的默认字体?您能否帮助我如何在移动应用程序的网络应用程序中使用非默认字体,特别是在 Android 操作系统中

提前致谢 - sri

I m developing mobile web application for Android OS. Here, my requirement is to use "Thoma" font, which is not default for desktop browsers and Android SDK webkit? Can you please help me how to use non-default font in web app in Mobile app, specifically in Android OS

Thanks in Advance - sri

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尹雨沫 2025-01-13 13:09:50

将所需的字体复制到 /assets/fonts 文件夹(如果没有,则创建文件夹,很可能没有)。

在您的活动中使用类似的内容:

Typeface tf = Typeface.createFromAsset(this.getAssets(), "fonts/ARLRDBD.TTF");
titleBarText.setTypeface(tf);

在我的例子中,字体是 Arial Bold。

Copy the font you want to /assets/fonts folder (create the folders if you don't have them, most probably you don't).

Use something like this in your activity:

Typeface tf = Typeface.createFromAsset(this.getAssets(), "fonts/ARLRDBD.TTF");
titleBarText.setTypeface(tf);

In my case the font is Arial Bold.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文