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>
上圖中,紅色部分就是其他壁紙,長按桌面,彈出小部件和壁紙,點擊壁紙,就會顯示出默認壁紙和其他壁紙了。