简体   繁体   中英

Styling the android action bar?

I'm trying to style the action bar inside my app using the code below.

 <resources>
<!-- the theme applied to the application or activity -->
<style name="myTheme" parent="@style/Theme.AppCompat">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
    <item name="actionBarStyle">@style/MyActionBar</item>

</style>

<!-- ActionBar styles -->
<style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">

    <item name="android:textSize">24sp</item>

</style>

simply put the font should be bigger.. but nope.

Any ideas as to why?

Thanks.

Possibly your theme is not applied to activity. Set it in manifest:

    <activity
        android:name=".YourActivty"
        android:theme="@style/myTheme" />

UPDATE 1

You should change action bar text size in such way (changing titleTextStyle):

<style name="Theme.YourTheme" parent="android:style/Theme">
    <item name="android:actionBarStyle">@style/Theme.YourTheme.Styled.ActionBar</item>
</style>

<style name="Theme.YourTheme.Styled.ActionBar">
    <item name="android:titleTextStyle">@style/Theme.Viadeo.Styled.YourTheme.TitleTextStyle</item>
</style>

<style name="Theme.YourTheme.Styled.ActionBar.TitleTextStyle" parent="@android:style/Widget.TextView">
    <item name="android:textSize">24sp</item>
</style>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM