Customize Touch Feedback

Touch feedback in material design provides an instantaneous visual confirmation at the point of contact when users interact with UI elements. The default touch feedback animations for buttons use the new RippleDrawable class, which transitions between different states with a ripple effect.

In most cases, you should apply this functionality in your view XML by specifying the view background as:
?android:attr/selectableItemBackground for a bounded ripple
?android:attr/selectableItemBackgroundBorderless for a ripple that extends beyond the view

Note: selectableItemBackgroundBorderless is a new attribute introduced in API level 21. Alternatively, you can define a RippleDrawable as an XML resource using the ripple element.

You can assign a color to RippleDrawable objects. To change the default touch feedback color, use the theme'sandroid:colorControlHighlight attribute.

Reference

https://developer.android.com/training/material/animations.html

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,596评论 2 45
  • 一切都在建设中,没有什么是毋庸置疑,确定无误的,生活本就如此,理应如此。漂泊和动荡是精神的徜徉之地。
    抱膝危坐阅读 205评论 0 0
  • 刘涛,作为一个内地知名女演员,具有“国民好媳妇”的美誉。从电视剧《妈祖》跳入小编的心,端庄大气、慈眉善目;从...
    我爱刨根问底阅读 549评论 6 3
  • js 中数组的长度发生改变,数组就真的发生改变,快速清空数组就让数组长度为0js 数组的方法
    发光驴子阅读 185评论 0 0
  • 骑马追晚霞 随处皆是家 遥远亦不远 仗剑走天涯
    大瘦泽阅读 242评论 1 2