我是靠谱客的博主 寒冷板栗,这篇文章主要介绍如何实现Button水波纹效果-Android 5.0 material design Reveal效果,现在分享给大家,希望可以做个参考。

导语:
Android 5.0以后官方出了更美观的Ui效果,今天我们实现Android 5.0 material designReveal效果,也就是button 点击时候出现的波纹。
步骤:
1.

复制代码
1
2
//引入这个material design compile 'com.android.support:design:23.0.1'

2.在drawable中加入以下设置:
创建一个文件 button_gray_orange(随便起名)

复制代码
1
2
3
4
5
6
<?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/white"> <item android:drawable="@drawable/button_gray_style" /> </ripple>

在创建一个文件 button_gray_style
备注:button_gray_style 就是一个普通的Shape 文件,你可以在里面做各种设置

复制代码
1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="@color/gray_light" /> </shape> //shape设置,我们这里写个最简单的,并没有圆角,或者边框之类的特殊效果。

3.在普通具有点击事件的控件中引用即可

复制代码
1
2
3
4
5
6
7
<TextView android:layout_width="match_parent" android:text="复旦大学" android:background="@drawable/button_white_orange" android:layout_height="wrap_content" />

最后

以上就是寒冷板栗最近收集整理的关于如何实现Button水波纹效果-Android 5.0 material design Reveal效果的全部内容,更多相关如何实现Button水波纹效果-Android内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(66)

评论列表共有 0 条评论

立即
投稿
返回
顶部