Nisarg Mehta
Nisarg Mehta

Reputation: 3

Cant style Android ActionMode

I am making a notes app.In that app i want an actionmode to trigger when long pressed on any item.It works but i cant change any style attributes of the actionmode.I have included my custom style in the styles.xml of my app, still doesn't work

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>

I specifically want to remove a green divider line that shows up at the bottom of the contextual menu i have attached the picture please see green divider line below the action mode menu

Upvotes: 0

Views: 435

Answers (1)

Nisarg Mehta
Nisarg Mehta

Reputation: 3

solved it. The problem was with the theme applied to the custom toolbar that i implemented. applied the lighttheme and everything works fine

Upvotes: 0

Related Questions