I have compound view, root tag is merge, in code of this view i set background according attribute app:hasbackground which i defined in attrs. Here is the method:
private fun updateBackground(data: ViewData) {
background = ContextCompat.getDrawable(context,
if (data.hasBackground){
R.drawable.bg_view
}else {
R.drawable.bg_ripple
}
)
}
the problem i have is that if i set onClick for this view in fragment/activity it doesnt have any ripple effect but it triggers action that i setted. Here is R.drawable.bg_view:
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:radius="0dp"
android:color="@color/surface_200">
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<solid android:color="@color/surface_100" />
<corners android:radius="@dimen/radius_12dp"/>
</shape>
</item>
</ripple>
if i add android:foreground="?attr/selectableItemBackground" in view with merge tag it doesn't working, if i add this in place where i use custom view it starts working but ripple doesn't have corners