Toolbar ripple disabled

I use the Toolbar in my application and inflate it using the menu. I have a problem because the ripple effect is automatically added to the button, but the effect of the left most ripple is interrupted by the border of the menu area.
You can see how the ripple expands, but then it remains left.
Any idea how to fix this problem?

enter image description here

+4
source share
2 answers

I also came across this, after I started playing, I found that our custom ThemeOverlay had its own background set.

Try removing android:background from the style and theme of the toolbar.

See below. I commented: <item name="android:background">@color/toolbar</item> . After that, it works as expected.

 <style name="MyTheme.Overlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"> <item name="android:textColorPrimary">@color/text_primary</item> <item name="android:textColorSecondary">@color/text_secondary</item> <item name="android:windowBackground">@color/background</item> <!--<item name="android:background">@color/toolbar</item>--> <!-- colorPrimary is used for the default action bar background --> <item name="colorPrimary">@color/toolbar</item> <!-- colorPrimaryDark is used for the status bar --> <item name="colorPrimaryDark">@color/toolbar</item> <!-- colorAccent is used as the default value for colorControlActivated, which is used to tint widgets --> <item name="colorAccent">@color/accent</item> </style> 
+2
source

The easiest way is to add a button on the toolbar, for example, a simple view, for example:

 <android.support.v7.widget.Toolbar android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/toolbar"> <ImageButton android:layout_width="match_parent" android:layout_height="wrap_content" android:src="ICON HERE" android:background="@null"/> </android.support.v7.widget.Toolbar> 

Android: background = "@ zero"

it will turn off the ripple effect using the button

0
source

All Articles