I create my own toolbar for working on a project. Everything looks great, except for the overlapping ripple of the action buttons on the toolbar.
Image for reference here
This happens on both sides of the toolbar (for example, with action buttons, as well as a navigation icon)
Here is the relevant code:
activity.xml
..<android.support.v7.widget.Toolbar
android:id="@+id/searchToolbar"
android:theme="@style/ToolbarTheme"
style="@style/ToolbarStyle">
</android.support.v7.widget.Toolbar>..
activity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search);
mToolbar = (Toolbar) findViewById(R.id.searchToolbar);
setSupportActionBar(mToolbar);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
getSupportActionBar().setTitle(R.string.search);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
styles.xml
<style name="ToolbarTheme" parent="Theme.AppCompat.Light">
<item name="android:textColorPrimary">@android:color/white</item>
<item name="android:textColorSecondary">@android:color/white</item>
<item name="actionMenuTextColor">@android:color/white</item>
<item name="android:background">@color/main_orange</item>
</style>
<style name="ToolbarStyle">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:minHeight">?actionBarSize</item>
</style>
I tried to remove the title from the toolbar and instead insert a TextView, but the same problem pops up.
I see this problem on the Nexus 4 API running API 21. There are no problems on the M8 19 API, I understand that this is due to the candy animation engine responsible for the ripple effect.
Thanks guys