1

I'm looking at implementing a cardview which has a button with the ripple effect. I'm talking about something like this : https://lh5.ggpht.com/uTRdkJMNyy3KasauJsyGTTRHn5EZBtmA3-BVHCaHWiqBIF_XQmJg_MuE8OdisvefdEk=h900-rw)

I'm trying to implement the download/share button as present on those cards. Should I be using an ImageButton or something else? Also, how can I extend the same support for pre-lollipop devices?

UPDATE:

This is the code I'm using right now. It gives me an image button but I'n not able to get touch/ripple effects. The android:foreground property works for cardView and gives the ripple effect, but not for ImageButton.

      <ImageButton
            android:id="@+id/ib_open_map"
            android:background="@drawable/ic_directions_grey600_36dp"
            android:foreground="?android:attr/selectableItemBackground"
            android:clickable="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />
akshayt23
  • 2,793
  • 3
  • 21
  • 29

1 Answers1

1

I think this can be interesting for you. You will have to import or link the library to be able to use it.

Here is the link to the library : Link to the library

It is easy to use and it is based on imageView.

Hope it helps you :) Let me know

EDIT Editing my link for your update :) Take a look at this : MaterialRipple

Arthur Lemoine
  • 200
  • 3
  • 9
  • Hi, I'm not actually looking for something like this. Please check the update in the question. – akshayt23 Apr 19 '15 at 14:52
  • The links look promising. I'll check them out. Thanks. :) – akshayt23 Apr 19 '15 at 15:09
  • How can include the RippleEffect library into my project? – akshayt23 Apr 19 '15 at 15:20
  • If you are using android studio, it is easy : in you projet gradle file, you have to add new dependencies `compile 'com.github.traex.rippleeffect:library:1.2.4'` else you will have to download the RippleEffect projet and add it to your project as a library as explained [here](http://stackoverflow.com/a/8281477/3858220) – Arthur Lemoine Apr 19 '15 at 15:26
  • Good job glad to have helped you ;) – Arthur Lemoine Apr 19 '15 at 16:06