工具欄ActionMode似乎忽略了我在棒棒堂前的設備樣式。工具欄ActionMode背景前棒棒糖不起作用
這是我的風格:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<!--We will be using the toolbar so no need to show ActionBar-->
<item name="windowActionBar">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:textColorPrimary">#DD000000</item>
<item name="android:textColorSecondary">#8A000000</item>
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette-->
<!-- colorPrimary is used for the default action bar background -->
<!-- Set AppCompat’s color theming attrs -->
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/secondary</item>
<item name="colorAccent">@color/accent</item>
<item name="android:actionModeStyle">@style/Widget.ActionMode</item>
<item name="android:actionModeBackground">@drawable/toolbar_action_background</item>
<item name="android:actionModeCloseDrawable">@drawable/ic_arrow_back_white_24dp</item>
</style>
<style name="Widget.ActionMode" parent="@style/Widget.AppCompat.ActionMode">
<item name="android:background">@drawable/toolbar_action_background</item>
<item name="android:titleTextStyle">@style/TitleTextStyle</item>
</style>
<style name="TitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#fff</item>
</style>
而且我的工具欄XML
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:elevation="4dp"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:background="?attr/colorPrimary" />
我檢查了這些問題: How to specify dark action mode with my theme Toolbar and Contextual ActionBar with AppCompat-v7 Unable to style action mode when using Toolbar
預期的行爲,工作正常上棒棒糖:
如何它看起來奇巧:
這裏有類似的問題,看我的【答案】(http://stackoverflow.com/questions/29121515/how-to-fix -copy-paste-layout-bug-in-edittext/29123467#29123467),如果有幫助,請投票。 – Harry 2015-04-02 13:37:30
@Harry,你可以看到我已經使用Theme.AppCompat.Light.NoActionBar作爲父主題? – Richard 2015-04-02 14:07:54
發佈您的主佈局。 – Harry 2015-04-02 14:15:12