android自定义开机动画

来源:互联网 发布:西安交大软件学院 编辑:程序博客网 时间:2024/05/01 08:13

对于已root过的手机,我们可以在/system/media下找到bootanimation.zip文件,解压后 文件内容如下

文件夹名称 intro mobility可自定义,但是必须与desc.txt中的一致,而且desc.txt是不允许重命名的

desc.txt内容如下:

#-------------------------desc.txt-------------------------------

# 320 wide, 320 tall 15 frames per second
320 320 15
 
# p means we're defining a part
# first number is repeat count, 0 means infinite
# second number is delay in frames before performing the next part
# so if you are playing 15 frames a second 15 would be... one second
# string defines the directory to load files from
# files will be loaded in order but names don't matter
 
# s defines a sound for a part
# sounds will be loaded from /system/media
# oggs with loop points will loop automatically
# only one sound will play at a time
# timing is driven by the part, not the sounds
# if you want no sound, leave blank
 
# intro
p 1 15 intro
 
# mobility
p 1 0 mobility
 
# carrier
#p 0 0 TEST
#s att_power_opt.ogg

#-------------------------End-----------------------------------

红字部分即位上述文件夹名称,绿色部分则为开机音乐文件,笔者未研究声音,固不作解释和修改,有兴趣的朋友可以自己看看,其实,文本上半部分的注释已经很详细了。

文件夹中则存放开机动画所需要的没一张图片,按续编号,如下

有了这些,再说说如何制作bootanimation.zip文件。

1.最好在windows环境下,本人用xp测试过,成功!

2.使用winRar,将上述三个目标压缩成bootanimation.zip,【不能使用其他名字】,要注意:压缩格式必须是.zip, 还有最重要的是,压缩方式【必须】选择为【“存储”】否则系统读不到的。完成,可以替换原有开机动画啦!


ps:笔者在压缩时没太注意,使用了默认的“标准”,结果导致开机动画总是得不到执行,各种蛋疼啊,最好在网上找到方法,原来是压缩的问题。

至于开机动画具体的代码实现,大家可以在 {Your SourceCode}/frameworks/base/cmds/bootanimation中找到,是用C++写的,里面规定了配置文本必须命名为desc.text.

下面是BootAnimation的代码,来自android 4.1.2源码,

地址:http://download.csdn.net/detail/zjc08125/5293218




原创粉丝点击