Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set part of Actionbar title bold

i would like to have an actionbar title like "titlepart1titleparttwo". But as I understand it correctly through a theme you can either set the whole title on bold or not but not partly. Is there any workaround?

<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>

<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">#81CFEB</item>
    <item name="android:textStyle">bold</item>
</style>
like image 579
SnafuBernd Avatar asked Oct 26 '25 03:10

SnafuBernd


1 Answers

No need to use themes, actually.

CharSequence instances can have markup information. You can add Spans manually, or you can use the Html class to make it easier. For example:

actionBar.setTitle(Html.fromHtml("titlepart1<b>titleparttwo</b>"));
like image 82
matiash Avatar answered Oct 28 '25 15:10

matiash



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!