Is it possible to have a ripple effect on a button that is part of remote views? (notification via custom layout or widget)
I tried setting the button background to drawable notification_material_media_action_background:
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/ripple_material_dark"/>
but it has no effect. The same background is used in the Notification source code, and there is a ripple effect on the notification buttons. This is the code from the notification source that creates the action button (with ripple effect):
private RemoteViews More ...generateMediaActionButton(Action action) { final boolean tombstone = (action.actionIntent == null); RemoteViews button = new RemoteViews(mBuilder.mContext.getPackageName(), R.layout.notification_material_media_action); button.setImageViewResource(R.id.action0, action.icon); button.setDrawableParameters(R.id.action0, false, -1, 0xFFFFFFFF, PorterDuff.Mode.SRC_ATOP, -1); if (!tombstone) { button.setOnClickPendingIntent(R.id.action0, action.actionIntent); } button.setContentDescription(R.id.action0, action.title); return button; }
The only difference seems to be related to this line:
button.setDrawableParameters(R.id.action0, false, -1, 0xFFFFFFFF, PorterDuff.Mode.SRC_ATOP, -1);
but this method is @hide, so it cannot be called.
Any idea how to add ripple effect? Thanks!