如何实现Button水波纹效果-Android 5.0 material design Reveal效果

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

//引入这个material design
compile 'com.android.support:design:23.0.1'

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

<?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 文件,你可以在里面做各种设置

<?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.在普通具有点击事件的控件中引用即可

    <TextView
        android:layout_width="match_parent" 
        android:text="复旦大学" 
        android:background="@drawable/button_white_orange"
        android:layout_height="wrap_content" />
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值