我想将应用程序的背景设置为与主屏幕壁纸相同。如何获取activity.xml中的主屏幕壁纸?我可以这样做吗?
Use
final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
final Drawable wallpaperDrawable = wallpaperManager.getDrawable();
获取当前壁纸。然后将其设置为您自己的应用程序的背景:
LinearLayout ll = (LinearLayout) findViewById(R.id.myLinearLayout);//Substitute with your layout
ll.setBackground(wallpaperDrawable);
如果您希望将其作为初始背景,所有这些都应该在 onCreate() 中发生。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)