gpt4 book ai didi

Android Lollipop - 通知中的涟漪效应

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:38:08 25 4
gpt4 key购买 nike

我想在 Android Lollipop 的通知中为 ImageView/ImageButton 添加波纹效果。我看到这在 Google Play 音乐上是可行的。但是,我在其他 View 中使用的解决方案不适用于通知。

我在 drawable-v21 中创建了 RippleDrawable

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

并将这个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"
/>

但这根本行不通。您知道如何实现这种效果吗?

最佳答案

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

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

在您自定义布局的 View 组中。

关于Android Lollipop - 通知中的涟漪效应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28130366/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com