Android设置桌面背景图片的实现方法


1.设置桌面背景图片的方法

复制代码 代码如下:

Resources res=getResources();
BitmapDrawable bmpDraw=(BitmapDrawable)res.getDrawable(R.drawable.icon);
Bitmap bmp=bmpDraw.getBitmap();
try{
setWallpaper(bmp);
}catch(IOException e) {
e.printStackTrace();
}


2.在manifest中增加设置桌面的权限

<uses-permission android:name="android.permission.SET_WALLPAPER" />
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3