修改源码如下,这个问题主要原因是没有根据图片实际尺寸设置壁纸大小
public static Point getDefaultWallpaperSize(Resources res, WindowManager windowManager,Activity activity) {
if (sDefaultWallpaperSize == null) {
Point realSize = new Point();
windowManager.getDefaultDisplay().getRealSize(realSize);
int maxDim = Math.max(realSize.x, realSize.y);
int minDim = Math.min(realSize.x, realSize.y);
// We need to ensure that there is enough extra space in the wallpaper
// for the intended parallax effects
final int defaultWidth, defaultHeight;
if (res.getConfiguration().smallestScreenWidthDp >= 720) {
defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim));
defaultHeight = maxDim;
} else {
defaultWidth = Math.max((int