gpt4 book ai didi

android - 如何更改工具栏的背景

转载 作者:行者123 更新时间:2023-11-30 01:41:26 25 4
gpt4 key购买 nike

我有一个大问题。当我启动 ActionMode 时,我无法为 ToolBar 设置背景。

我明白了:

enter image description here

我尝试了很多变体,但没有找到适合我的答案(这是我的风格:

<style name="DriverNotesAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/material_bg</item>
<item name="colorPrimaryDark">@color/status_bar</item>
<item name="colorAccent">@color/edittext_primary</item>
<item name="android:windowBackground">@color/light_blue</item>

<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>

<item name="android:textColorPrimaryInverse">@android:color/white</item>

<item name="android:textColorPrimary">@android:color/white</item>

<item name="actionMenuTextColor">@android:color/white</item>
<item name="android:actionModeBackground">@color/material_light_bg</item>

<item name="android:textColorSecondary">@android:color/white</item>

<item name="drawerArrowStyle">@style/WhiteDrawerIconStyle</item>

<item name="textAppearanceLargePopupMenu">@style/myPopupMenuTextAppearanceLarge</item>
<item name="android:textAppearanceLargePopupMenu">@style/myPopupMenuTextAppearanceLarge</item>

<item name="textAppearanceSmallPopupMenu">@style/myPopupMenuTextAppearanceSmall</item>
<item name="android:textAppearanceSmallPopupMenu">@style/myPopupMenuTextAppearanceSmall</item>

<item name="android:actionModeStyle">@style/LStyled.ActionMode</item>


<item name="popupMenuStyle">@style/ThemeOverlay.AppCompat.Light</item>

<item name="android:popupMenuStyle">@style/myPopupMenuStyle</item>
</style>


<style name="myPopupMenuTextAppearanceLarge" parent="@style/TextAppearance.AppCompat.Light.Widget.PopupMenu.Large">
<item name="android:textColor">#000000</item>
</style>

<style name="LStyled.ActionMode" parent="@style/Widget.AppCompat.ActionMode">
<item name="background">@color/material_light_bg</item>
</style>

最佳答案

试试这个,

toolbar.xml

<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/MyToolbarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">

主题/风格

<style name="MyToolbarStyle">
<item name="android:maxHeight">@dimen/abc_action_bar_default_height_material</item>
<item name="android:background">@color/primary</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
<item name="titleTextAppearance">@style/Theme.Toolbar.Title</item>
<!-- No need for colorPrimary, colorPrimaryDark, colorAccent here
this should go to the AppTheme -->
</style>

更多详情请访问this

关于android - 如何更改工具栏的背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34454347/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com