This was done using android 5.1 genymotion emulator
I didn't figure out your problem, but I just tried to create a toolbar the same as yours, but with removing some style that I don't have
here is my style
<style name="ToolbarTheme"
parent="Widget.AppCompat.Toolbar">
<item name="actionMenuTextColor">#1bff3a</item>
<item name="colorControlNormal">#FFF</item>
<item name="colorControlActivated">#FFF</item>
<item name="android:textColorPrimary">#FFF</item>
<item name="actionButtonStyle">@style/Widget.AppCompat.ActionButton</item>
<item name="selectableItemBackground">?android:selectableItemBackground</item>
<item name="selectableItemBackgroundBorderless">?android:selectableItemBackground</item>
<item name="colorControlHighlight">@color/accentColor</item>
</style>
My Toolbar layout
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?colorPrimary"
app:theme="@style/ToolbarTheme"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
/>
My Menu
<item
android:id="@+id/action_settings"
android:title="@string/action_settings"
android:icon="@drawable/abc_ic_clear_mtrl_alpha"
app:showAsAction="always"
/>
The activity code
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.inflateMenu(R.menu.menu_home);
Screenshot of the result
Edit
after downloading the sample you provided in the question, the problem has nothing to do with standalone toolbar or actionbar (both have the same problem) when using AppBarLayout
, the problem seems that the Ripple
effect will be drawn on AppBarLayout
instead of the View of the selected menu item, I'll record a video explaining it.
the video:
AppBarLayout with Toolbar Video
I'll try to find a solution for this.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…