0
点赞
收藏
分享

微信扫一扫

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

Raow1 2022-02-21 阅读 103
androidxml


效果图:

实现步骤:

1、在style.xml中添加

<style name="RippleWhite">
<item name="android:colorControlHighlight">#FAFAFA</item>
<item name="android:radius">25dp</item>
</style>

  • ​android:colorControlHighlight​​为点击后波纹的颜色
  • ​android:radius​​为效果半径(实测)

2、一个ImageButon

<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​​要设置为无边界的波纹

android:background="?android:attr/selectableItemBackgroundBorderless"

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



举报

相关推荐

0 条评论