Android Lollipop - 通知中的涟漪效应

rad*_*zio 6 android android-notifications rippledrawable android-5.0-lollipop

我想在Android Lollipop的通知中为ImageView/ImageButton添加涟漪效果.我在Google Play音乐上看到了这种情况.但是,我在其他视图中使用的解决方案不适用于通知.

我在drawable-v21中创建了RippleDrawable

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
        android:color="#33000000">
</ripple>
Run Code Online (Sandbox Code Playgroud)

并将此drawable设置为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"
            />
Run Code Online (Sandbox Code Playgroud)

但它根本行不通.你对如何实现这种效果有任何想法吗?

BCP*_*eng 1

我猜您使用“RemoteViews”来自定义您的通知布局。

尝试添加“android:background=”@android:color/transparent”

在您的自定义布局的视图组中。