Android-L CardView Visual Touch Feedback

后端 未结 4 484
故里飘歌
故里飘歌 2020-11-28 19:49

could anybody explain to me how to implement some of the visual touch feedback that was demonstrated at Google I/O 2014 within a CardView.

Here is how I am using the

4条回答
  •  隐瞒了意图╮
    2020-11-28 20:34

    This helped in my case

    Background:

    The CardView ignores android:background in favor of app:cardBackground which can only be color. The border and shadow are in fact part of the background so you cannot set your own.

    Solution:

    Make the layout inside the CardView clickable instead of the card itself. You already wrote both attributes needed for this layout:

    android:clickable="true"
    android:background="?android:selectableItemBackground"
    

提交回复
热议问题