简体   繁体   中英

How can I remove style from android's text selection contextual actionbar (actionmode)

Android's text selection contextual actionbar has inherited some style from my app that makes it look funny. I want to remove this styling and use the default. How can I achieve this? Preferably in xml rather than programmatically.

我想还原为此文本选择上下文操作栏的默认样式

I solved it by first discovering the right terminology. It is the text selection contextual actionbar but in the documentation it is referred to as the actionmode bar.

I did the following to style the bar as I please.

<!-- Application theme. -->
<style name="AppTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">match_parent</item>
    <item name="android:textColor">#c9c9c9</item>
    <item name="android:background">@color/background</item>
    <item name="android:actionModeStyle">@style/MyActionMode</item>
    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>

and then...

<!-- ActionMode styles -->
<style name="MyActionMode" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:background">@color/background</item>
</style>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM