CardView's background which will respond to android:state_selected and android:state_pressed

后端 未结 5 1579
独厮守ぢ
独厮守ぢ 2020-12-11 12:33

I\'m referring to the answer at https://stackoverflow.com/a/24475228/72437

The proposed answer is using drawable from Android : ?android:attr/selectableItemBac

5条回答
  •  不思量自难忘°
    2020-12-11 12:59

    I believe you are misunderstanding the question you referred to. The question is how to get the ripple effect:

    enter link description here

    Where I think you are just looking for click feedback? If so, try setting the background drawable:

      android:background="@drawable/statelist_item_background"
    

    EDIT:

    On you background color xml, you need to give it an alpha. It is being drawn in the front, so give it an alpha of .1f and see how that looks and go from there. Try using color 50F76D3C Then use is it in the foreground like you were originally.

提交回复
热议问题