2009-12-30 80 views
1

我想找出一些方法來確定手機上的當前背景,然後在我的應用程序中將該背景設置爲我自己的背景,以在我的應用程序和手機之間創建無縫過渡。但是,我一直無法在Androids SDK網站上找到任何此功能。如何將應用程序背景設置爲與當前背景相同?

在我的Manifest中設置android:theme =「@ style/Theme.NoBackground」幾乎做我想要的,但它仍然在背景中有圖標。

在此先感謝

回答

1

呀WallpaperManager就是答案,一點點在搜索的人的API演示誰需要這樣的一個披露這一點。

final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this); 
final Drawable wallpaperDrawable = wallpaperManager.getDrawable(); 

顯然將變量wallpaperDrawable添加到setBackgroundDrawable();

+0

不要忘記「接受」您在本網站發佈的問題的答案 - 只需點擊最相關答案下的大「勾號」圖標即可。 – 2010-01-03 19:56:17

1

你也應該能夠在你的清單,宣佈你的活動應該使用「牆紙」的主題,像這樣:

<activity android:theme="@android:style/Theme.Wallpaper"> 
0

你能在2.0之前調用this.getWallpaper()在你的活動。

1

嘗試使用下面的代碼在你的程序中,這樣就可以解決你的問題:

activity android:theme="@android:style/Theme.Wallpaper"

這將幫助你。