Skip to content

zhoukai1526/WaveApplication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WaveApplication

水波纹效果控件, 可以在水波上方添加图片,图片会随水波上下浮动.

attrs属性:


 <declare-styleable name="waveStyleable">
        <!-- 水波纹的长度-->
        <attr name="waveLength" format="float"> </attr>
         <!-- 水波纹的高度-->
        <attr name="waveHeight" format="float"> </attr>
        <!-- 水波纹的速度-->
        <attr name="waveSpeed" format="float"> </attr>
        <!--水波纹上方的头像 -->
        <attr name="waveTopIcon" format="reference"> </attr>
        <!--水波的颜色 -->
        <attr name="waveColor" format="color"> </attr>
        <!--水波距离底部的距离 -->
        <attr name="distanceY" format="float"> </attr>

</declare-styleable>


xml文件引入


   <com.iwintrue.waveapplication.WaveView
        xmlns:app="http://schemas.android.com/apk/res-auto"
        app:waveLength = "600"
        app:waveHeight = "50"
        app:waveSpeed = "10"
        app:waveColor = "#0ff"
        app:distanceY = "100"
        app:waveTopIcon = "@mipmap/icon"
        android:layout_centerInParent="true"
        android:id="@+id/waterView"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        />


效果图如下:




注意:

  • 水波纹上方的头像必须设置
  • 如果水波纹view的宽高有设置为wrapContent,则宽为水波纹的宽度,高度为头像高度+水波纹高度+水波纹距底部的高度

About

This is a water ripple custom view

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages