【发布时间】:2011-11-19 13:47:41
【问题描述】:
我目前正在构建一个应用程序,我想更换壁纸。所以这是我的代码。 当用户设置壁纸时,我会保存共享首选项的路径。
Display display = getWindowManager().getDefaultDisplay();
SharedPreferences prefs = getBaseContext().getSharedPreferences(PREFS_NAME,0);
if (prefs.contains(d)) {
Bitmap bitmapOrg = BitmapFactory.decodeFile(prefs.getString(d, ""));
int newWidth = display.getWidth();
int newHeight = display.getHeight();
Bitmap resizedBitmap =Bitmap.createScaledBitmap(bitmapOrg, newWidth, newHeight, true);
myWallpaperManager.setBitmap(resizedBitmap);
}
使用该代码,我得到了类似 this 的内容,而我想显示类似 this 的图片
知道怎么做吗?
【问题讨论】:
标签: android dimensions wallpaper homescreen