Android Lollipop - ripple effect in notification

I want to add a ripple effect to ImageView / ImageButton in the notification on Android Lollipop. I saw that this is possible on Google Play Music. However, the solution I used with other views does not work with notifications.

I created RippleDrawable in drawable-v21

<?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#33000000"> </ripple> 

And set this drawing as ImageView background

 <ImageView android:id="@+id/notification_play_button" tools:src="@drawable/av_play_over_video" android:layout_width="32dp" android:layout_height="32dp" android:background="@drawable/button_selector_semi_black" /> 

But that just doesn't work. Do you have any ideas on how to achieve this effect?

+6
source share
1 answer

I assume that you used "RemoteViews" to customize the notification layout.

Try adding "android: background =" @android: color / transparent "

in your custom layout viewer group.

+1
source

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


All Articles