微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法风格的 Android ActionMode

如何解决无法风格的 Android ActionMode

我正在制作一个笔记应用程序。在该应用程序中,我希望在任何项目上长按时触发动作模式。它可以工作,但我无法更改动作模式的任何样式属性。我已将我的自定义样式包含在 style.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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。