[英]Android Lollipop - ripple effect in notification
我想在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>
並將此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“
在自定義布局的視圖組中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.