【发布时间】:2015-01-15 13:26:21
【问题描述】:
我使用本教程为 Lollipop 改造了我的 Holo 应用程序: http://android-developers.blogspot.ru/2014/10/appcompat-v21-material-design-for-pre.html
我有什么:
-
主题
<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="windowActionModeOverlay">true</item> <item name="colorPrimary">@color/theme_primary</item> <item name="colorPrimaryDark">@color/theme_primary_dark</item> <item name="colorAccent">@color/theme_accent</item> </style> -
工具栏布局
<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:layout_height="wrap_content" android:layout_width="match_parent" android:minHeight="?attr/actionBarSize" android:background="?attr/colorPrimary" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> -
多选模式下继承自ActionBarActivity的带有ListFragment片段的Activity
getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
结果:工具栏正常。它使用指定的主题颜色,但 ActionMode 中 ListFragment 使用的 ActionBar(通过长按列表项激活)具有标准的 Dark.ActionBar 颜色。操作栏的弹出菜单也使用了深色主题。
我尝试了所有的 SO 技巧,但仍然无法解决。我将不胜感激。
顺便说一句。我发现ActionBar的颜色较深是由工具栏的app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"引起的,但不知道如何解决,因为正确的工具栏外观需要这个属性。
【问题讨论】:
标签: android android-actionbar android-5.0-lollipop android-appcompat material-design