我有一个工具栏,想要为我的标题使用自定义字体,但我无法使其生效。
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
SpannableString title = new SpannableString(getResources().getString(R.string.app_name));
title.setSpan(Typeface.createFromAsset(getAssets(), "KeepCalm-Medium.ttf"), 0, title.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
toolbar.setTitle(title);
setSupportActionBar(toolbar);
我认为我做得没错,但它什么也没做。