Android - How to get ripple effect on GridView items? -
i have implemented image gallery using gridview. layout grid item:
<framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:descendantfocusability="blocksdescendants" > <imageview android:id="@+id/media_item" android:layout_width="match_parent" android:layout_height="match_parent" android:contentdescription="@string/thumbnail_for_image" android:scaletype="centercrop" /> <view android:id="@+id/overlay_view" android:layout_width="match_parent" android:layout_height="match_parent" android:background="?attr/selectableitembackground" /> </framelayout>
my goal nice material ripple effect upon touching grid item. unfortunately, couldn't manage find pure solution problem. came using this, author says, work around - adding overlay view on top of main imageview, , setting background
?attr/selectableitembackground
putting imageview's background or parent framelayout background didn't work.
i'm sure, there must better way handle it.
android:drawselectorontop="true"
in gridview did trick
Comments
Post a Comment