Android boot animation, dependent plug-in
- Rely on:
- use
- Custom animation
- Custom attributes
Able to stay upright, insist on is seen, through the people are few and far between. — Victor Hugo
Rely on:
// Boot animation
implementation 'site. Gemus: openingstartanimation: 1.0.0'
Copy the code
use
private OpeningStartAnimation openingStartAnimation;
openingStartAnimation = new OpeningStartAnimation.Builder(this)
.setDrawStategy(new NormalDrawStrategy()) // Default animation
.create();
openingStartAnimation.show(this);
Copy the code
Rendering (1.1)
:
References to other animations:
Red, yellow, green animation / / RedYellowBlueDrawStrategy ()
// LineDrawStrategy()
// RotationDrawStrategy()
/ / NormalDrawStrategy () by default
openingStartAnimation = new OpeningStartAnimation.Builder(this)
.setDrawStategy(new NormalDrawStrategy())
.create();
Copy the code
RedYellowBlueDrawStrategy() | LineDrawStrategy() |
---|---|
RotationDrawStrategy() | NormalDrawStrategy() (the default) |
Custom animation
private OpeningStartAnimation openingStartAnimation;
openingStartAnimation = new OpeningStartAnimation.Builder(this)
.setDrawStategy(new DrawStrategy() {
@Override
public void drawAppName(Canvas canvas, float fraction, String name, int colorOfAppName, WidthAndHeightOfView widthAndHeightOfView) {}@Override
public void drawAppIcon(Canvas canvas, float fraction, Drawable icon, int colorOfIcon, WidthAndHeightOfView widthAndHeightOfView) {}@Override
public void drawAppStatement(Canvas canvas, float fraction, String statement, int colorOfStatement, WidthAndHeightOfView widthAndHeightOfView) {
}
})
.create();
Copy the code
Custom attributes
private OpeningStartAnimation openingStartAnimation;
openingStartAnimation = new OpeningStartAnimation.Builder(this)
.setAppIcon(getResources().getDrawable(R.mipmap.log)) // Set the icon
.setColorOfAppIcon(Color.RED) // Sets the color for drawing the icon line
.setAppName("Boot animation") // Set the app name
.setColorOfAppName(Color.YELLOW) // Set the app name color
.setAppStatement("January 23rd, 2021. I want another chance.") // Set a one-sentence description
.setColorOfAppStatement(Color.BLUE) // Set the color of a sentence description
.setAnimationInterval(3000) // Set the animation interval
.setAnimationFinishTime(3000) // Set the disappearance time of the animation
.create();
openingStartAnimation.show(this);
Copy the code
Rendering (1.2) :
\
See more useful plug-ins
Original is not easy, your praise is my biggest support ~