首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >简单实现安卓圆形按钮及(圆形)波纹效果

简单实现安卓圆形按钮及(圆形)波纹效果

作者头像
程思扬
发布于 2022-01-10 14:38:46
发布于 2022-01-10 14:38:46
2.4K0
举报
文章被收录于专栏:程思阳的专栏程思阳的专栏

效果图:

实现步骤: 1、在style.xml中添加

代码语言:text
复制
<style name="RippleWhite">
    <item name="android:colorControlHighlight">#FAFAFA</item>
    <item name="android:radius">25dp</item>
</style>
  • android:colorControlHighlight为点击后波纹的颜色
  • android:radius为效果半径(实测)

2、一个ImageButon

代码语言:perl
复制
<ImageButton
   android:id="@+id/view_back"
   android:layout_width="50dp"
   android:layout_height="50dp"
   android:layout_gravity="center_vertical"
   android:layout_marginLeft="20dp"
   android:background="?android:attr/selectableItemBackgroundBorderless"
   android:contentDescription="@string/text_back"
   android:src="@drawable/ic_arrow_back_white_24dp"
   android:theme="@style/Rip

其中重要属性android:background要设置为无边界的波纹

代码语言:text
复制
android:background="?android:attr/selectableItemBackgroundBorderless"

设置风格属性android:theme="@style/RippleWhite"

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018/06/06 ,如有侵权请联系 cloudcommunity@tencent.com 删除
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档