【问题标题】:Cant style Android ActionMode无法风格的 Android ActionMode
【发布时间】:2021-07-23 10:56:43
【问题描述】:

我正在制作一个笔记应用程序。在该应用程序中,我希望在长按任何项目时触发动作模式。它可以工作,但我无法更改动作模式的任何样式属性。我已将我的自定义样式包含在 styles.xml我的应用程序,仍然无法正常工作

styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">

    <style name="Theme.MyApplication" parent="Theme.MaterialComponents.Light.NoActionBar">
        <!-- Primary brand color. -->
        <item name="colorPrimary">@color/white</item>
        <item name="android:textColor">@color/black</item>
        <item name="colorPrimaryVariant">@color/blue_main</item>
        <item name="colorOnPrimary">@color/white</item>
        <!-- Secondary brand color. -->
        <item name="colorSecondary">@color/white</item>
        <item name="colorSecondaryVariant">@color/white</item>
        <item name="colorOnSecondary">#778899</item>
        <!-- Status bar color. -->
        <item name="android:statusBarColor" tools:targetApi="m">#D3D3D3</item>
        <item name="android:actionBarStyle" >@style/Theme.AppCompat.Light</item>
        <item name="actionModeStyle">@style/Widget.ActionMode</item>
        <item name="actionBarTheme">@style/Theme.AppCompat.Light</item>
    </style>

    <style name="Widget.ActionMode" parent="@style/Widget.AppCompat.Light.ActionMode.Inverse">
        <item name="background">?attr/actionModeBackground</item>
        <item name="android:actionBarDivider">@null</item>
        <item name="actionModeCloseDrawable">@drawable/cancel</item>
        <item name="android:actionModeBackground">@android:color/white</item>
    </style>

    <style name="CustomMaterialDialog" parent="@style/ThemeOverlay.MaterialComponents.MaterialAlertDialog">
        <!-- Background Color-->
        <item name="android:background">#FFFFFF</item>
        <!-- Text Color for title and message -->
        <item name="colorOnSurface">#BF40BF</item>
        <!-- Text Color for buttons -->
        <item name="colorPrimary">#BF40BF</item>
        <item name="shapeAppearanceOverlay">@style/ShapeAppearance.MaterialComponents.LargeComponent
        </item>

    </style>



</resources>

我特别想删除显示在上下文菜单底部的绿色分隔线,我已附上图片,请参阅green divider line below the action mode menu

【问题讨论】:

    标签: java android android-layout android-actionmode


    【解决方案1】:

    解决了。问题在于应用于我实现的自定义工具栏的主题。应用了 lighttheme,一切正常

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-28
      • 2011-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多