本篇文章将实现如下效果:
贴上实现代码:
布局文件:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@mipmap/content" />
<com.source.api28.show.wave.SplashView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
后面实际上是一个图片作为背景:
content.jpg
最后是代码:SplashView
public class SplashView extends View {
private Paint mPaint;
private Paint mWavePaint;
/**
* 屏幕正中间坐标
*/
private float mCenterX;
private float mCenterY;
/**
* 转圈的起始半径
*/
private float mB