Implementing Ripple effect outside ImageButton

前端 未结 3 1365

I am trying to implement ripple effect for ImageButton.I have set ripple in background and drawable image in the src for it.

android:background=\"@drawable/         


        
3条回答
  •  不思量自难忘°
    2020-12-29 21:05

    I ran into this and my issue is that 'selectableItemBackgroundBorderless' creates a rectangle, while my button was circular. I'm not sure if this answers the original question but here is what I found: set the background to this in drawable-v21

    
        
            
                
            
        
    
    

    and @null in lower api levels (assuming you're using a selector for the actual image button src). The ripple most visible in the padding of the button. If there's no masking layer at all The ripple is unbound and kind of takes over the whole screen. You can use whatever shape you want if not a circle.

提交回复
热议问题