Material ripple effect hidden by other view in layout

后端 未结 4 2066
一个人的身影
一个人的身影 2020-12-05 14:51

I added a ripple effect on a ImageButton, however it is hidden by an ImageView used as a background for the parent view RelativeLayout

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 15:35

    I had exactly the same issue and solved it using this thread: https://code.google.com/p/android/issues/detail?id=155880

    Issue preview:

    Before solved:

    After solved:

    Explanation:

    "Borderless buttons draw their content on the closest background. Your button might not be having background between itself and the ImageView, so it draws underneath the ImageView."

    Solution:

    "Use a transparent background (android:background="@android:color/transparent") on some layout containing the button (beneath the ImageView). This will dictate what the maximum bounds of the ripple effect is."

    
    
        
        
    
            
    
        
        
    
             
    
            
            
    
        
    
    
    

    Hope it helps.

提交回复
热议问题