android手机系统含有两种壁纸,一种是默认壁纸,还有一种是其他的。
默认壁纸一般存储在framework里:frameworks\base\core\res\res\drawable-nodpi\default_wallpaper.png
其他壁纸存储在Launcher里:packages\apps\Launcher3\WallpaperPicker\res,我们在packages\apps\Launcher3\WallpaperPicker\res\drawable-nodpi目录下存放了一些壁纸,原图和其小图,其中Launcher不一定为Launcher3,也可以为Launcher2,关键看你手机用的是哪个launcher。我们需要在packages\apps\Launcher3\WallpaperPicker\res\values-nodpi\目录下对wallpapers.xml文件进行修改:
<?xml version="1.0" encoding="utf-8"?>
<!--
* Copyright (C) 2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<resources>
<string-array name="wallpapers" translatable="false">
<item>wallpaper_01</item>
<item>wallpaper_02</item>
<item>wallpaper_03</item>
<item>wallpaper_04</item>
<item>wallpaper_05</item>
<item>wallpaper_06</item>
</string-array>
</resources>
上图中,红色部分就是其他壁纸,长按桌面,弹出小部件和壁纸,点击壁纸,就会显示出默认壁纸和其他壁纸了。