How do you get a ripple effect to expand the boundaries of your views?

The effect of sensory pulsation here extends beyond. How it's done?

enter image description here

EDIT: I agree that this only works with 5.0+.

+6
source share
3 answers

I read from several places that:

If you want to apply the standard ripple effect on Android 5.0: API 21 or more, which should not be limited to your presentation (unlimited ripple), simply apply the following to the background:

android:background="?android:attr/selectableItemBackgroundBorderless" 
+5
source

I tested it, what is happening here, that the ripple is not on the buttons, but on the background object. Thus, the ripple does not actually pass by the borders of the buttons here, but rather extends to the borders of the background cover map object.

To reproduce what you see in the picture,
1. Make a new layout. I would use either relative layout or linearlayout
2. Add the top EditText (β€œAdd Short Note”), and then the four bottom buttons, all with clear backgrounds but with gray borders, as shown above.
3. Set the ripple animation against the background of the layout into which you paste the buttons, and do not forget to set android:clickable="true" to your layout!

This gave me the same effect as your photo.

+3
source

doc already mentioned this

 //An unbounded red ripple. <ripple android:color="#ffff0000" /> 

https://developer.android.com/reference/android/graphics/drawable/RippleDrawable.html

0
source

Source: https://habr.com/ru/post/982906/


All Articles