欢迎您访问新疆栾骏商贸有限公司,公司主营电子五金轴承产品批发业务!
全国咨询热线: 400-8878-609

新闻资讯

常见问题

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

作者:用户投稿2026-01-11 14:29:25
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" />