Question

I'm currently trying to set the font weight of my ActionBar title to bold, with the following code, but it isn't working as expected. What am i doing wrong?

<style name="dActionBar" parent="@android:style/Widget.Holo.ActionBar">
        <item name="android:background">#DDDDDD</item>
        <item name="android:textColor">#FFFFFF</item>
        <item name="android:textStyle">bold</item>
        <item name="android:foreground">#000000</item>
    </style>

The background color and so on is working pretty well.

Was it helpful?

Solution

not all Android fonts have bold style,for example Chinese words must use setFakeBoldText

        final int actionBarTitle = getResources().getIdentifier("action_bar_title", "id", "android");
        final TextView title = (TextView) getActivity().getWindow().findViewById(actionBarTitle);
        title.getPaint().setFakeBoldText(true);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top