Android的WallpaperManager作物图像 [英] Android WallpaperManager crops image

查看:157
本文介绍了Android的WallpaperManager作物图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作,我有一些图像的简单的壁纸应用程序。他们是png格式的绘制文件夹中的文件。

I am working on a simple wallpaper app of some images that I have. They are .png files in drawable folders.

下面是一些code片段:

Here are some code snippets:

WallpaperManager myWallpaperManager = WallpaperManager.getInstance(getApplicationContext()); 
....
myWallpaperManager.setResource(R.drawable.image1);

无论我似乎什么尺寸或分辨率来使用,当壁纸设置它裁剪原始图像。当我使用相同的图像作为背景它是正确的大小和显示整个图像。我想这可能是我的模拟器上的问题,所以我试图在实际设备上运行它(HTC Eris的)和我有同样的问题。我做了图像的屏幕尺寸和分辨率为阋神星和它仍然是种植它。然后我的形象只有一英寸高,100 dpi的分辨率。这是非常像素化的厄里斯,但仍裁剪图像。

No matter what size or resolution I seem to use, when the wallpaper is set it crops the original image. When I use the same image as a background it is the correct size and shows the entire image. I thought it might be a problem with my emulator so I have tried running it on an actual device (HTC eris) and I am having the same problem. I have made the image the screen size and resolution for the eris and it is still cropping it. I then made the image only one inch high and a resolution of 100 dpi. It was very pixelated on the eris, but still cropped the image.

任何帮助将是很大的AP preciated。

Any help would be greatly appreciated.

我试图添加一些图像之前和之后,以显示,但作为一个新用户我是从这样做pvented $ P $

I attempted to add some images to show the before and after, but as a newer user I was prevented from doing so.

推荐答案

检查所返回的值<一href="http://developer.android.com/reference/android/app/WallpaperManager.html#getDesiredMinimumWidth" rel="nofollow">http://developer.android.com/reference/android/app/WallpaperManager.html#getDesiredMinimumWidth()和<一href="http://developer.android.com/reference/android/app/WallpaperManager.html#getDesiredMinimumHeight" rel="nofollow">http://developer.android.com/reference/android/app/WallpaperManager.html#getDesiredMinimumHeight()并尝试使用这些值作为你的壁纸的尺寸。

Check the values returned by http://developer.android.com/reference/android/app/WallpaperManager.html#getDesiredMinimumWidth() and http://developer.android.com/reference/android/app/WallpaperManager.html#getDesiredMinimumHeight() and try to use these values as the dimensions of your wallpaper.

这篇关于Android的WallpaperManager作物图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆