主屏幕壁纸在进入后台时会变焦

时间:2017-06-01 11:53:29

标签: android wallpaper

我已安排后台服务定期更改设备主屏幕壁纸。壁纸改变成功,它们完美地设置为屏幕尺寸。 但是当我离开主屏幕并返回时,图像会被放大太多,只留下一部分图像可见。下面给出的是我使用的代码

    Bitmap theBitmap = null;
    try {
        DisplayMetrics metrics = new DisplayMetrics();
        WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
        windowManager.getDefaultDisplay().getMetrics(metrics);
        int height = metrics.heightPixels;
        int width = metrics.widthPixels;
        theBitmap = Glide.with(mContext)
                .load(PhotoPath)
                .asBitmap().into(width, height).get();

        WallpaperManager wm = WallpaperManager.getInstance(mContext);
        wm.setWallpaperOffsetSteps(1, 1);

        wm.suggestDesiredDimensions(width, height);
        try {
            wm.setBitmap(theBitmap);Album
        } catch (IOException e) {

        }
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
}

尽量不要急于将此问题标记为重复。有些问题表明图像在设置时会放大,但我的壁纸设置得很完美,至少它最初确实如此。当我将主屏幕移动到背景时,为什么会放大。

Image as long as I do not perform any action taking the homescreen to the background Image after I move from homescreen and get back(Zoomed in)

0 个答案:

没有答案