Reputation: 2943
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" />
Upvotes: 1
Views: 2361
Reputation: 200
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
Upvotes: 1