Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/207.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何将font.ttf发送到其他活动_Android_Android Intent_Fonts - Fatal编程技术网

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
    字符串
    字体名称映射到
    字体
    ),并通过
    意图
    额外操作将密钥传递到该缓存条目