Android 如何将font.ttf发送到其他活动
我想在其他活动中动态使用字体 当前我的字体设置为Android 如何将font.ttf发送到其他活动,android,android-intent,fonts,Android,Android Intent,Fonts,我想在其他活动中动态使用字体 当前我的字体设置为 custom_font = Typeface.createFromAsset(getAssets(), "fonts/AbrilFatface-Regular.ttf"); font.setTypeface(custom_font); 我想将此字体动态添加到其他活动中您可以: 通过一个额外的Intent传递路径(“font/abrilface Regular.ttf”),并调用另一个活动createFromAsset(),或 维护一个进程级的
custom_font = Typeface.createFromAsset(getAssets(), "fonts/AbrilFatface-Regular.ttf");
font.setTypeface(custom_font);
我想将此字体动态添加到其他活动中您可以:
- 通过一个额外的
传递路径(Intent
),并调用另一个活动“font/abrilface Regular.ttf”
,或createFromAsset()
- 维护一个进程级的
缓存(例如,字体
将LRUCache
字体名称映射到字符串
),并通过字体
额外操作将密钥传递到该缓存条目意图