Objective
welcome everyone I share and recommend useful code Snippets ~ ~
Statement
Welcome reprint, but please keep the original source of the article:
CSDN:http://www.csdn.net
rainy season o mo away:http://blog.csdn.net/luckkof
Body
KK Launcher3 Wallpaper display is dynamic, related to the number of launcher preset desktop, let the wallpaper center, only to ensure that the first time the wallpaper center, after the user modified the number of desktops, will not be able to achieve. How to center the default number of desktops in the configuration, you can refer to the following method, the default one screen as an example:Replace the Launcher3 Workspace.java file with the following functionprivate voidUpdateoffset(Boolean force) {
if (mwaitingforupdate | | force) {
Mwaitingforupdate = false;
LAUNCHERLOG.D (TAG, "updateoffset:mwallpaperoffset =" + Mwallpaperoffset.getcurrx ());
if (Computescrolloffset () && Mwindowtoken! = null) {
try {
if (Getchildcount () <= 1) {
LAUNCHERLOG.D (TAG, "Wallpaperoffset 111");
Mwallpapermanager.setwallpaperoffsets (Mwindowtoken,
/* MWALLPAPEROFFSET.GETCURRX () */0.5f, 0.5f);
}else{
LAUNCHERLOG.D (TAG, "Wallpaperoffset 222");
Mwallpapermanager.setwallpaperoffsets (Mwindowtoken,
Mwallpaperoffset.getcurrx (), 0.5f);
}
Setwallpaperoffsetsteps ();
} catch (IllegalArgumentException e) {
LOG.E (TAG, "Error Updating wallpaper offset:" + e);
}
}
}
}