In my Android 5, by using the following theme
themes.xml
<style name="Theme.MyApp.Light.DarkActionBar" parent="Theme.AppCompat.Light.NoActionBar">
and the following toolbar
toolbar.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:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="@color/background_material_dark"
android:elevation="4dp"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" >
</android.support.v7.widget.Toolbar>
This is what I'm getting, when my ListViewFragment
goes into action mode via
this.getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
this.getListView().setMultiChoiceModeListener(new ModeCallback());
I want to have exact look and feel for my Android 4.
If we didn't do anything in Android 4, toolbar in action mode will look very wrong.
It seems like bug in Android support library : https://code.google.com/p/android/issues/detail?id=143419&thanks=143419&ts=1423493133
I had referred to Styling ActionMode ActionBar in Android 5.0 Lollipop (with AppCompat)
<style name="Theme.MyApp.Light.DarkActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="actionModeBackground">@color/background_material_dark</item>
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Light</item>
This is what I get.
- Text color isn't right
- There is no green separator.
- Back icon color isn't right.
I further follow Unable to style action mode when using Toolbar
<style name="Widget.ActionMode" parent="@style/Widget.AppCompat.ActionMode">
<item name="background">@color/background_material_dark</item>
<item name="backgroundSplit">@color/accent_material_light</item>
<item name="titleTextStyle">@style/TextAppearance.AppCompat.Widget.ActionMode.Title.Inverse</item>
<item name="subtitleTextStyle">@style/TextAppearance.AppCompat.Widget.ActionMode.Subtitle.Inverse</item>
</style>
<style name="Theme.MyApp.Light.DarkActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="actionModeStyle">@style/Widget.ActionMode</item>
<item name="actionModeCloseDrawable">@drawable/ic_arrow_back_white_24dp</item>
It is getting better (Correct color for back icon)
However, I'm still facing problem.
- Text color isn't right
- There is no green separator.
I was wondering, what is the correct approach to get correct look n feel as in Android 5's ?