Here is my custom ripple
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:colorControlHighlight">
<item android:drawable="@color/white" />
</ripple>
How do I make it borderless?
Here is my custom ripple
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:colorControlHighlight">
<item android:drawable="@color/white" />
</ripple>
How do I make it borderless?
As per the RippleDrawable documentation, a ripple will be masked against the composite of its child layers.
In this case, your drawable will be masked by the only item in your ripple.
To have a ripple with no mask, you can define your ripple like so:
<ripple android:color="?android:colorControlHighlight" />
I had the same problem, while I stumbled upon this question. I have solved my problem easily and there is a code
Btw it works only for cases when height equals width. Else it will be not ?attr/selectableItemBackgroundBorderless
, but ripple oval
<?xml version="1.0" encoding="utf-8"?>
<ripple android:color="@color/grayPrimary" xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/mask">
<shape android:shape="oval">
<solid android:color="#000000"/>
</shape>
</item>
</ripple>
© 2022 - 2024 — McMap. All rights reserved.
android:background="?attr/selectableItemBackgroundBorderless"
– Tempa