Reputation: 193
How to make a ripple effect for a menu that covers the entire item 'Settings'?
Now ripple effect for menu item without icon looks like this:
Upvotes: 1
Views: 310
Reputation: 608
Add below line to your xml view
<TextView
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"/>
Upvotes: 0
Reputation: 193
I've solved this problem with this code
<style name="AppTheme.AppBarOverlay.WithTextMenuItems" parent="AppTheme.AppBarOverlay">
<item name="android:actionBarItemBackground">@drawable/bg_ripple_button_rounded</item>
</style>
Upvotes: 1
Reputation: 3212
Here's an example from my app:
<Button
android:id="@+id/apply_button"
style="@style/MyTextButtonTheme"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_marginTop="@dimen/margin_extra_small"
android:layout_marginEnd="@dimen/margin_small"
android:layout_marginBottom="@dimen/margin_extra_small"
android:letterSpacing="0.07"
android:text="@string/apply"
android:textColor="?attr/colorAccent"
android:textSize="@dimen/text_button_size"
app:layout_constraintBottom_toBottomOf="@id/up_navigation_imageButton"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/up_navigation_imageButton" />
And this goes in styles.xml:
<!-- Change ripple color on TextButtons -->
<style name="MyTextButtonTheme" parent="Widget.MaterialComponents.Button.TextButton">
<item name="rippleColor">?attr/colorOnBackgroundMediumContrast</item>
</style>
https://github.com/gavingt/upcoming-games
Upvotes: 0