Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Lollipop - ripple effect in notification

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

I've 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 drawable as background of ImageView

<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 it simply does not work. Do you have any ideas how to achieve this effect?

like image 824
radzio Avatar asked Jan 24 '15 21:01

radzio


1 Answers

I guess you used "RemoteViews" to customized your notification layout.

Try to add "android:background="@android:color/transparent"

in your customized layout's view group.

like image 72
BCPeng Avatar answered Sep 27 '22 21:09

BCPeng