【问题标题】:Title do not appear on android action bar标题不会出现在 android 操作栏上
【发布时间】:2015-03-25 00:32:17
【问题描述】:

我正在尝试使用背景颜色设置我的操作栏的样式。我还在操作栏中显示的 android 清单文件中给出了标签。但是当我尝试使用 Style.xml 更改背景颜色时,它会更改背景颜色但不显示标签。 下面是样式 xml

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->

</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    <item name="actionBarStyle">@style/MyActionBar</item>  
 </style>


<style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
    <item name="background">@color/actionbarcolor</item>
</style>

能否请您告诉我,我应该进行哪些更改,以便在应用背景颜色后也显示标签名称。

我在清单文件的应用程序级别应用了主题“AppTheme”。

【问题讨论】:

    标签: android


    【解决方案1】:

    尝试添加这个

    <style>
        <item name="android:actionBarTabTextStyle">@style/AwesomeTabTextStyle</item>
    </style>
    
    <style name="AwesomeTabTextStyle" parent="@android:style/Widget.ActionBar.TabText">
        <item name="android:textAppearance">@android:style/TextAppearance.Medium</item>
        <item name="android:textSize">14sp</item>
        <item name="android:textColor">@color/actionbar_text_color</item>
    </style>
    

    【讨论】:

    • 谢谢 nayoso。我尝试添加上面的行,但没有用。我在
    • 你的actionbar是什么颜色的?
    • 我使用 parent 作为
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多