一个Activity声明如下:
<activity android:name=".MainActivity"
android:theme="@android:style/Theme.Wallpaper.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
可以看到Activity的背景变成了桌面壁纸,其原理是将壁纸设置为了Activity中某个View的背景吗,如果是,怎么找到这个View,并获取这个壁纸实例(也就是这个壁纸)呢?
PHP中文网2017-04-17 17:50:23
Every activity needs setContentView. This View is.
But this has nothing to do with theme. The theme acts on the Activity and does not directly affect the View
PHP中文网2017-04-17 17:50:23
The principle is not to set the wallpaper as the background of a certain View, create a simple Activity and then traverse upward to get this conclusion
There is no detailed analysis of this principle after looking up some information. It is speculated that the wallpaper is displayed through a lower-level mechanism...
If you find relevant analysis information, please share it, thank you :D