That's because AppCompat now uses a ToolBar
widget as replacement for ActionBar. ToolBar
creates a TextView
instance for the title on-the-fly; if you dig into the (android.support.v7.widget.)ToolBar
code, you'll find something like this:
mTitleTextView = new TextView(context);
(Refer to line 607 of android.support.v7.widget.ToolBar
in appcompat-v7-23.0.1-sources.jar
)
More importantly, no id is ever assigned to the view. This can also easily be seen by inspecting the view hierarchy:

That TextView
that you see is the one that holds the title. The id is a generated value and not predefined (like i.e. the one for the ActionBarContainer
), which means you can no longer look it up through some sort of static reference.
That explains why your code, which does an id-lookup-by-name, no longer works: the action_bar_title
id is simply no longer being used here.
There are several solutions to make setting a custom font to the ActionBar title work again. The cleanest is probably to leverage the fact that setTitle()
takes a CharSequence
, which means you can attach a custom typeface span to it that enables the custom font and/or style to work. Doing this is some sort of a 'base' Activity
would probably make most sense.
You can of course also iterate over the local view hierarchy, starting at ToolBar
, but I'd say that's not quite as robust and prone to suffer from future changes (like your current code ;)).
Alternatively, consider using a library to simplify dealing with applying custom fonts. Calligraphy is usually my first stop for this.