これは私の CardView レイアウトです:
<it.gmariotti.cardslib.library.view.CardView
xmlns:card="http://schemas.android.com/apk/res-auto"
android:id="@+id/list_cardId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
card:card_layout_resourceID="@layout/cardview_history"
style="@style/list_card.base"/>
そのレイアウトに基づいて、私の CardViews レイアウトは正しく表示されますが、押されたときに強調表示されません。
IceCreamSandwich (API 15 : 4.0.4) では、後の OS バージョンとは異なり、CardView をクリックしても強調表示されません。そこで、背景の card_selector を CardView に明示的に追加しようとしました。
android:background="@drawable/card_selector"
私は、cardslib リソース (card_selector.xml) で利用可能なデフォルトの既存のドローアブルを使用しています:
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:state_activated="true" android:drawable="@drawable/activated_background_card"/>
<item android:state_pressed="true" android:drawable="@drawable/pressed_background_card"/>
<item android:drawable="@drawable/card_background"/>
</selector>
しかし、これが私の CardViews レイアウトになる方法です。ご覧のとおり、そのうちの 1 つが押されていますが、正しく強調表示されていません。
押されたときに CardView が正しく強調表示されるようにする解決策はありますか?