java.lang.runtimeException:无法制作本机字体和自定义字体



我有这两个代码(两个活动)

MainActivity

namespace App16
{
    [Activity(Label = "App16", MainLauncher = true, Icon = "@drawable/icon")]
    public class MainActivity : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            TextView tv = FindViewById<TextView>(Resource.Id.textView1);
            Button button = FindViewById<Button>(Resource.Id.button1);
            var activity2 = new Intent(this, typeof(Activity1)).SetFlags(ActivityFlags.ReorderToFront);
            string[] str = new string[2];
            str[0] = "hello"; str[1] = "سلام";
            activity2.PutExtra("MyData", str);
            button.Click += delegate
            {
                StartActivity(activity2);
            };
        }
    }
}

活动

namespace App16
{
    [Activity(Label = "Activity1")]
    public class Activity1 : Activity
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            SetContentView(Resource.Layout.Main2);
            string[] text = Intent.GetStringArrayExtra("MyData");
            TextView tvE = FindViewById<TextView>(Resource.Id.textView3);
            TextView tvP = FindViewById<TextView>(Resource.Id.textView2);
            Typeface typeP = Typeface.CreateFromAsset(this.Assets, "fonts/blotus.ttf");
            tvP.SetTypeface(typeP, TypefaceStyle.Normal);
            if (text[0] == "hello")
            {
                tvE.Text = text[0];
                tvP.Text = text[1];
            }
        }
    }
}

这些效果很好,但是当我在另一个程序中使用它们时,我有一个错误:

java.lang.runtimeException:无法制作本机字体

我不知道为什么?

我将字母的字母更改为大写字母,我的问题已解决:blotus.ttf

最新更新