您的位置:首页 > Web前端

Customize-Touch-Feedback

2015-03-11 11:41 274 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息