Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/185.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自定义字体创建错误_Android_Fonts_Textview_Typeface - Fatal编程技术网

Android自定义字体创建错误

Android自定义字体创建错误,android,fonts,textview,typeface,Android,Fonts,Textview,Typeface,用户可以在我的应用程序中选择不同的字体 字体是在以下代码中创建的: public static Typeface getTypeFace(Context context, String assetPath) { synchronized (cache) { if (!cache.containsKey(assetPath)) { try { Typeface typeFace = Typeface.createFro

用户可以在我的应用程序中选择不同的字体

字体是在以下代码中创建的:

public static Typeface getTypeFace(Context context, String assetPath) {
    synchronized (cache) {
        if (!cache.containsKey(assetPath)) {
            try {
                Typeface typeFace = Typeface.createFromAsset(
                        context.getAssets(), assetPath);
                cache.put(assetPath, typeFace);
            } catch (Exception e) {
                return null;
            }
        }
        return cache.get(assetPath);
    }
}
字体创建时没有错误,但在Android>5.0中,字体完全错误

当我在Android 4.4.2操作系统上使用我的应用程序时,它的创建是正确的

造成麻烦的字体是:

你知道怎么处理吗