首页 > 代码库 > [Quote] How To Change, Customize & Create Android Boot Animation [Guide]

[Quote] How To Change, Customize & Create Android Boot Animation [Guide]

From http://www.addictivetips.com/mobile/how-to-change-customize-create-android-boot-animation-guide/

 

How To Change, Customize & Create Android Boot Animation [Guide]

 
55
 

The boot animation is the first thing that you see when powering on your Android phone or tablet, after the operator or manufacturer logo. Although it does not serve a purpose functionally, an eye-catching boot animation can certainly make your device stand out while booting. In this third installment of our Android customization series, we will take a look at how to change or even create your Android boot animation and will feature some of the prettiest and geekiest boot animations we have come across.

 

技术分享

This guide is a part of our series on how to customize the looks of your Android device. Other guides in this series include:

  1. Introduction to Android customization
  2. Make & Flash your own Android Splash Screen with Splash Screen Creator
  3. How to Change, Customize & Create Android Boot Animation (Currently viewing)
  4. How To Replace and Customize Android Lock Screen
  5. The Ultimate Guide to Android Wallpapers
  6. Replace and Personalize your Home Screen with the Best Android Launchers

Note that there may be changes in this layout as we proceed, and we will be updating the links as we keep publishing the parts.

Let’s now proceed with customizing the boot animation. This guide in itself will be organized as follows:

  • The Basics
  • Inside the bootanimation.zip file
  • Featured Boot Animations
  • Create Your Own Boot Animation
  • Apply a Boot Animation

The Basics

The Android boot animation is contained within a an uncompressed zip file called bootanimation.zip that can be found in the media folder of the system partition i.e. /system/media on the internal memory of the device. This single file contains all the information required to play the boot animation, and is loaded automatically when the device boots. Thus, customizing or changing the boot animation is simply the process of editing or replacing this file.

Inside the bootanimation.zip file

This section is for those interested in finding out how the Android boot animation works. If you just want to install one without bothering yourself about what’s in the file, feel free to move on to the next section, as this one will get a little technical. Though it should be easy and simple enough for anyone to grasp.

While the Android boot animation might appear to be in a video format during playback, it is in fact a little different. If you extract the contents of the bootanimation.zip file to your computer, you will see:

  • A desc.txt file
  • A part0 folder (Contains PNG images named in incremental numbers)
  • More part1, part2 etc. folders (May or may not be present)

As you can see, bootanimation.zip merely contains one text file and one or more folders with PNG images. The animation is played simply by displaying the images in a sequence, and the text file defines how they are to be played. In essence, first the PNG files in the part0 folder are displayed one after the other and afterwards, those in the part1 file – if it exists – are displayed, again one after the other, and so on. All of this is defined in the desc.txt file.

Let’s see how it works in a little detail by taking a closer look at the contents of the file.

The folders

These contain PNG images named in numbers, starting from something like 0000.jpg or 00001.jpg and proceeding with increments of 1. There has to be at least one folder, and there is no known upper limit to the number of folders.

The desc.txt file

This file defines how the images in the folder(s) are displayed during the boot animation, in the following format:

Width Height Frame-rate
p Loop Pause Folder1
p Loop Pause Folder2

An example of a desc.txt file is:

480 800 30
p 1 0 part0
p 0 0 part1

As you can see, in the first line, 480 and 800 define the width and height of the boot animation in pixels for this example. This must be the same as the screen resolution of your device for the boot animation to properly play in full screen. 30 is the frame rate in fps (frames per second) i.e. number of images to display per second.

The second and third lines have a same format, start with p, which stands for a part of the animation and end in part0 or part1, which denotes the folder in which the images for that part are present.

The number after ‘p’ defines how many times this part will loop (repeat playback) before switching to the next part (if present). Specifying 0 would make the part loop indefinitely till the phone has fully booted.

The next number is for the pause, and is expressed in the number of frames, which can be translated into time by dividing it by the frame rate. A pause of 15 for example, would mean pausing for the time it takes 15 frames to play and since the frame rate is 30 frames per second, 15 frames would take half a second.

Translating all of this in case of the above example, the boot animation will play at a resolution of 480 by 800 pixels, at a frame rate of 30 fps, starting with the contents of part0 folder and after playing them in one loop, switching to contents of part1 folder and playing them continuously till the device fully boots.

A note on resolution: Most high-end Android devices with large screens have a resolution of 480 x 800 pixels, and are referred to as HDPI. Some mid-range devices have a resolution of 320 x 480 pixels and are called MDPI. Lastly, the screen resolution of some low-end devices is 340 x 320 pixels and these are called LDPI, though these are either the really old Android phones or the cheapest Chinese models.

As a rule, a boot animation made for a lower resolution device will run fine on a high resolution one but it will be centered on the screen, with the extra screen space around it not being used. Using a high resolution boot animation on a low resolution device will result in the boot animation not fully displaying on the screen, with its outer parts being cut off due to being outside the screen’s bounds.

Featured Boot Animations

There are hundreds of boot animations out there for a range of device resolutions. Some of them come as stock with certain devices and get extracted by users to be made available for others to install on their devices, while others are custom built by users and shared with the community.

As promised, we are featuring here a few boot animations that caught our eye.

The Droids series by Dysgenic:

 

技术分享 技术分享

技术分享 技术分享

Download (XDA-Developers)

Android Particle Ring by Dysgenic (Modified by aph):

技术分享 技术分享

[Quote] How To Change, Customize & Create Android Boot Animation [Guide]