我想要将自定义字体应用于我的应用程序标题,该标题显示在ActionBar上。以前我没有使用任何支持库,使用了以下解决方案:
int titleId = getResources().getIdentifier("action_bar_title", "id",
"android");
TextView yourTextView = (TextView) findViewById(titleId);
yourTextView.setTypeface(face);
以前我使用时一切正常。但现在我正在使用 Material Design 的 SupportActionBar,这会抛出 NullPointerException。那么,在使用 AppCompat 时如何更改 ActionBar 字体?