我试图通过在活动XML文件中设置android:backgound属性(如android Developers页面上的here所述),让CardView在touch 时显示连锁react ,但它不起作用.完全没有动画,但是调用了onClick中的方法.我也try 过制造涟漪.xml文件,如建议的here,但结果相同.
在活动的XML文件中显示的CardView:
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="155dp"
android:layout_height="230dp"
android:elevation="4dp"
android:translationZ="5dp"
android:clickable="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:onClick="showNotices"
android:background="?android:attr/selectableItemBackground"
android:id="@+id/notices_card"
card_view:cardCornerRadius="2dp">
</android.support.v7.widget.CardView>
我对安卓系统的开发还比较陌生,所以我可能犯了一些明显的错误.