如何让所有动作栏项目变白?

时间:2015-02-27 17:15:28

标签: android xml android-actionbar android-theme android-styles

由于this HTC bug,我无法使用Theme.AppCompat.Light.DarkActionBar

所以我一直在努力寻找解决方法。我尝试删除DarkActionBar,只使用Theme.AppCompat.Light作为我的应用主题的父级;它修复了错误,但我的操作栏中的某些项目显示为黑色:

Black searchview sign, back button, overflow icon Black search text and clear button Black Drawer-arrow-toggle and menu item text

显示为黑色的项目:v7 ActionBarDrawerToggle,SearchView控件,SearchView文本,溢出菜单图标,菜单项文本。

有没有办法让它们全白?

1 个答案:

答案 0 :(得分:0)

使用工具栏:

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:background="@color/blue"
    android:layout_height="@dimen/actionbar_height"/>

并在样式和清单上添加:

<style name="AppTheme" parent="Theme.AppCompat.Light">

    <item name="colorPrimary">@color/white</item>
    <item name="colorPrimaryDark">@color/light_gray</item>
    <item name="android:textColorPrimary">@color/white</item>
    <item name="colorAccent">@color/white</item>
    <item name="android:textColorPrimaryInverse">@color/white</item>
    <item name="actionMenuTextColor">@color/white</item>
    <item name="android:textColorSecondary">@color/white</item>
    <item name="android:actionMenuTextColor">@color/white</item>
    <item name="android:windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:windowBackground">@color/white</item>

</style>
相关问题