1

I have the following Custom GridView:

<android.support.v7.widget.CardView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
app:cardCornerRadius="2dp"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="5dp">

    <ImageView
        android:id="@+id/grid_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_weight="4"/>
    <TextView
        android:id="@+id/grid_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"/>
  </LinearLayout>
</android.support.v7.widget.CardView>

Now I have a GridView with CardView style but when I click on any item there's no clicking effect (I would like to have the cicle clicking effect of android 5.0 or at least any effect of clicking!) and I really don't know how to archieve this. Any help would be appreciated!

Cheers.

Uchiha
  • 332
  • 3
  • 13

1 Answers1

1

Got the answer, need to add this: setDrawSelectorOnTop(true) The gridviews selector works, but it's drawing behind my cardview so I just needed to draw it on top with this code...

This is what helped me out: Android drawSelectorOnTop with GridView

Community
  • 1
  • 1
Uchiha
  • 332
  • 3
  • 13