最近学习了贝塞尔曲线的一些知识,刚好项目中需要实现一个圆形进度,然后就将实现的waveView记录一下。...colorAccent" wave:progress_text_size = "20sp" wave:progress_text_color = "@color/circle_color"/ 这样就完成了自定义WaveView
本文实例为大家分享了android自定义WaveView水波纹控件的使用方法,供大家参考,具体内容如下 Github Repository and libaray WaveView水波纹控件 首先看下演示...url 'https://jitpack.io' } } } 在你需要引用的module中添加如下依赖: dependencies { compile 'com.github.onlynight:WaveView...:1.0.0' } 使用 布局文件中添加view: <com.github.onlynight.waveview.WaveView android:id="@+id/waveView1" android...) findViewById(R.id.waveView1); // when you want start wave you should call WaveView#start() method....(); View 属性说明 <declare-styleable name="<em>WaveView</em>" <!
); mWaveLenght1 = typedArray.getInteger(R.styleable.WaveView_wave1Length, WAVE_LENGTH1); mWaveHeight1...(R.styleable.WaveView_wave1Color, WAVE_COLOR1); mOffset1 = typedArray.getInteger(R.styleable.WaveView_wave1Offset...(R.styleable.WaveView_intervalTime, DEFAULT_TIME); mPrecent = typedArray.getFloat(R.styleable.WaveView_precent...--自定义水波纹效果属性-- <declare-styleable name="<em>WaveView</em>" <!...= (WaveView) findViewById(R.id.waveview1); btStart = (Button) findViewById(R.id.bt_start); btStop =
public class WaveView extends View { private static final String TAG = "WaveView"; private int waveColor...private int centerIconHeight; private float[] waveDegreeArr; private boolean isRunning = true; public WaveView...(Context context) { this(context, null); } public WaveView(Context context, AttributeSet attrs) { super...context, AttributeSet attrs) { TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.WaveView...(R.styleable.WaveView_waveCount, 4); Drawable centerDrawable = typedArray.getDrawable(R.styleable.WaveView_waveCenterIcon
> <attr name="waveColor" format="color|reference...public <em>WaveView</em>(Context context) { this(context, null); } public <em>WaveView</em>(Context context, AttributeSet...attrs) { this(context, attrs, 0); } public <em>WaveView</em>(Context context, AttributeSet attrs, int defStyleAttr...context, attrs, defStyleAttr); TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.<em>WaveView</em>...到这里基本就讲得差不多了,以下是本案例的源码: <em>WaveView</em>.rar
View的构造函数有四种重载分别如下: public void WaveView(Context context) {} public void WaveView(Context context, AttributeSet...attrs) {} public void WaveView(Context context, AttributeSet attrs, int defStyleAttr) {} public void...public void WaveView(Context context, AttributeSet attrs) {} **以下方法调用的是一个参数的构造函数:** //在Avtivity中 WaveView...所以我们当前例子里面,只需要留下二个参数的public void WaveView(Context context, AttributeSet attrs) {}构造函数即可。...findViewById(R.id.image); waveView3 = (WaveView) findViewById(R.id.wave_view); final
前言 ---- 项目中需要实现音频智能控制以及根据音乐转换色彩功能,WaveView 完全满足目前需求,完美实现需求,该库还有另外 WaveSurferView 和 FrequencyHistogramView...WaveView 动态显示波形 ---- 此功能源码:waveview.js,4kb 大小源码,录音时动态显示波形;外观为上面Gif图第一行,可通过参数配置绘制成不同的外观。...FrequencyHistogramView 音频模块 frequency.histogram.view.js lib.fft.js WaveSurferView 音频模块 wavesurfer.view.js WaveView...动态显示波形模块 waveview.js
原因很简单: 目前 github 能搜索到的比较流行的水波开源库,如:tangqi92/WaveLoadingView、john990/WaveView、gelitenight/WaveView 等目前看起来对水波本身的可定制程度不高
叶子状进度条.gif self.waveView = [[JWWavesAnimationView alloc] initWithFrame:CGRectMake(([[UIScreen mainScreen...bounds].size.width - 200) / 2, ([[UIScreen mainScreen] bounds].size.height - 120) / 2, 200, 120)]; [_waveView...setUp]; [self.view addSubview:self.waveView]; //mask 蒙版 CALayer *maskLayer = [CALayer layer]; [maskLayer...setFrame:self.waveView.bounds]; maskLayer.contents = (id)[UIImage imageNamed:@"123456"].CGImage; self.waveView.layer.mask...= maskLayer; 使用了图片作为遮罩图层,self.waveView为一个水波上涨的自定义试图,其中水波的上升效果是通过核心动画和 CAShapeLayer的path动态绘制实现的,先了解更多的可以看我的其他两篇文章
"distanceY" format="float" </attr </declare-styleable </resources 自定义view绘制水波纹控件 public class WaveView...private Region region; private int width,height; public int translateX ; private float distanceY; public WaveView...(Context context) { super(context); } public WaveView(Context context, AttributeSet attrs) { super(context...match_parent" tools:context="com.iwintrue.waveapplication.MainActivity" <com.iwintrue.waveapplication.WaveView
path.rQuadTo(rangeX,-rangeY,rangeX*2,0); i+=(rangeX*2); } 完整代码: public class WaveView...extends View{ Paint paint ; Path path; public WaveView(Context context) { super...(context); } public WaveView(Context context, AttributeSet attrs) { super(context, attrs...extends View{ Paint paint ; Path path; int change; public WaveView(Context context)...{ super(context); } public WaveView(Context context, AttributeSet attrs) { super
二、实现原理 自定义view,使用Path和贝塞尔曲线绘制,然后不断刷新,并且改变X、Y的值 主要知识点rQuadTo的使用 三、实现 WaveView.java public class WaveView...; //波长 private int wavelength = 500; private int originY=800; private int dx,dy; public WaveView
第二条曲线也可以很明显的看出来终点是在x轴的0点坐标,Y轴不变,而控制点是在负的波长的1/4的位置 有了上下曲线以后,其他的就可以直接通过循环进行添加了 接下来直接看一下代码 public class WaveView...private int centerY; private ValueAnimator mValueAnimator; //偏移量 private int mOffset; public WaveView...(Context context) { this(context, null); } public WaveView(Context context, @Nullable AttributeSet
removeAllObjects]; } } index++; } self.timeView.points = self.pointArrays; self.waveView.points...currentTime = weakSelf.player.currentTime.value / weakSelf.player.currentTime.timescale; [weakSelf.waveView
安卓定制刷新头部 waveview
所以我们当前例子里面,只需要留下二个参数的public void WaveView(Context context, AttributeSet attrs) {}构造函数即可。
整体实现 class WaveView(context: Context, attributeSet: AttributeSet?
WaveView - openHarmony 的波形图,可用作进度条。
领取专属 10元无门槛券
手把手带您无忧上云