ui - Android Activity theme是作用于哪个View?
阿神
阿神 2017-04-17 17:48:23
0
3
536

一个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,并获取这个壁纸实例(也就是这个壁纸)呢?

阿神
阿神

闭关修行中......

reply all(3)
左手右手慢动作

getWindow().getDecorView();this

洪涛

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

洪涛

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template