1

次のカスタム 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>

今、私は CardView スタイルの GridView を持っていますが、アイテムをクリックしてもクリック効果はありません (Android 5.0 の cicle クリック効果または少なくともクリックの効果が欲しいです!) 方法が本当にわかりませんこれをアーカイブします。どんな助けでも大歓迎です!

乾杯。

4

1 に答える 1

1

答えを得たので、これを追加する必要があります: setDrawSelectorOnTop(true) gridviews セレクターは機能しますが、カードビューの背後に描画されているため、このコードで上に描画する必要がありました...

これが私を助けてくれました: Android drawSelectorOnTop with GridView

于 2015-01-03T14:02:35.953 に答える