【问题标题】:Styling the android action bar?样式化 android 操作栏?
【发布时间】:2015-08-11 22:39:02
【问题描述】:

我正在尝试使用下面的代码在我的应用中设置操作栏的样式。

 <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>

只是把字体应该更大..但不是。

关于为什么的任何想法?

谢谢。

【问题讨论】:

标签: android


【解决方案1】:

您的主题可能未应用于活动。在清单中设置它:

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

更新 1

您应该以这种方式更改操作栏文本大小(更改 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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-04-16
    • 1970-01-01
    • 2023-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-03
    • 1970-01-01
    相关资源
    最近更新 更多