Reputation: 4456
I'm trying to imitate this effect:
But I'm not able to, I've been doing this:
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:color="#fff"
tools:targetApi="lollipop">
<item android:id="@android:id/mask">
<shape android:shape="oval">
<solid android:color="?android:colorAccent" />
</shape>
</item>
</ripple>
Upvotes: 3
Views: 2634
Reputation: 4737
You don't need any custom background just use an ImageButton like this:
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="..."/>
You may need to add a padding as well.
Upvotes: 1