Dowemo
0 0 0 0

Can the system wallpaper picture be set to the screen size.

A system default wallpaper image is twice the width of a screen, with 2 purposes:
1. Wallpaper can slip as the launcher workspace is sliding.
2. When the screen is landscape, the background of the show wallpaper flag is set to display properly.
If you change the width of wallpaper to the same height as the screen, you'll cause the following risk:
1. The background of the launcher workspace will be stretched,.
2. The background of the show wallpaper flag is set to display incomplete in horizontal ( a black screen is displayed on the right, such as the recent interface ).
Hidden trouble 1 can be solved by modifying code resolution ( the following code is a critical hazard 1 ), hidden risk 2. So it isn't recommended to modify it.

M ve ion:

1. In the wallpaperutils. Java getdefaultwallpapersize method, find the following code:

if (res.getConfiguration().smallestScreenWidthDp> = 720) {
defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim));
defaultHeight = maxDim;
} else {
defaultWidth = Math.max((int) (minDim * WALLPAPER_SCREENS_SPAN), maxDim);
defaultHeight = maxDim;
}
请先确认代码走哪个分支(这与手机分辨率有关),然后把defaultWidth 和defaultHeight 改为屏幕宽高。修改方法
如下(以else分支示例):
Point realSize = new Point();
windowManager.getDefaultDisplay().getRealSize(realSize);
if (isScreenLarge(res)) {
defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim));
defaultHeight = maxDim;
} else {
defaultWidth = realSize.x;
defaultHeight = realSize.y;
}

Kk ve ion:

1. In the wallpapercropactivity. Java getdefaultwallpapersize method, find the following code:

if (isScreenLarge(res)) {
defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim));
defaultHeight = maxDim;
} else {
defaultWidth = Math.max((int) (minDim * WALLPAPER_SCREENS_SPAN), maxDim);
defaultHeight = maxDim;
}
请先确认代码走哪个分支(这与手机分辨率有关),然后把defaultWidth 和defaultHeight 改为屏幕宽高。修改方法
如下(以else分支示例):
Point realSize = new Point();
windowManager.getDefaultDisplay().getRealSize(realSize);
if (isScreenLarge(res)) {
defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim));
defaultHeight = maxDim;
} else {
defaultWidth = realSize.x;
defaultHeight = realSize.y;
}

2. Find the loadsettinglocked method for wallpapermanagerservice. Java and remove the following code:

if (wallpaper.width <baseSize) {
wallpaper.width = baseSize;
}

Previous ve ion:

Modify the packagesappslauncher2srccomandroidlauncher2workspace. Java setwallpaperdimension ( ) method, as follows:

protected void setWallpaperDimension() {
Point minDims = new Point();
Point maxDims = new Point();
mLauncher.getWindowManager().getDefaultDisplay().getCurrentSizeRange(minDims, maxDims);
final int maxDim = Math.max(maxDims.x, maxDims.y);
final int minDim = Math.min(minDims.x, minDims.y);
//mtk add start
Display disp = mLauncher.getWindowManager().getDefaultDisplay();
DisplayMetrics mDiaplayMetrics = new DisplayMetrics();
disp.getRealMetrics(mDiaplayMetrics);
final int dispW = mDiaplayMetrics.widthPixels;
final int dispH = mDiaplayMetrics.heightPixels;
//mtk add end
//We need to ensure that there is enough extra space in the wallpaper for the intended
//parallax effects
if (LauncherApplication.isScreenLarge()) {
mWallpaperWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim));
mWallpaperHeight = maxDim;
} else {
//mtk add start
mWallpaperWidth =dispW;//Math.max((int) (minDim * WALLPAPER_SCREENS_SPAN), maxDim);
mWallpaperHeight = dispH;//maxDim;
//mtk add end
}
new Thread("setWallpaperDimension") {
public void run() {
mWallpaperManager.suggestDesiredDimensions(mWallpaperWidth, mWallpaperHeight);
}
}.start();





Copyright © 2011 Dowemo All rights reserved.    Creative Commons   AboutUs