2

Latest versions of YouTube app on android shows a ripple which is pretty different.

That is when we lift our finger from button, then at the time of ending ripple it shows stroke.

How to achieve this type of ripple in android?

When we lift finger, there is stroke at the end of ripple.

Chaitanya Karmarkar
  • 1,425
  • 2
  • 7
  • 18

2 Answers2

0

It is actually just a ripple background by setting android:background="?selectableItemBackground"

In Youtube button example,

<RelativeLayout
    android:id="@+id/rl_chat_search"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?selectableItemBackground"  <-- ripple effect
    android:layout_margin="10dp">

    <ImageView
        android:src="@drawable/ic_download"

    />

    <TextView
        android:text="Download"
      />
</RelativeLayout>
Dharman
  • 30,962
  • 25
  • 85
  • 135
Teo
  • 876
  • 9
  • 22
0

Add below two attribute in your click view.

android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
Dharmender Manral
  • 1,504
  • 1
  • 6
  • 7