What is an Android DecorView?

后端 未结 2 580
梦如初夏
梦如初夏 2021-01-30 10:17

http://developer.android.com/reference/android/view/Window.html#getDecorView():

Retrieve the top-level window decor view (containing the standard window

相关标签:
2条回答
  • 2021-01-30 10:55

    Decor view appears to contain screen resolution? I get 1920.

    var verticalScreenRes = act.window.decorView.height.toFloat() // 1920
    

    then verify

    adb -s emulator-5554 shell wm size
    Physical size: 1080x1920
    
    0 讨论(0)
  • 2021-01-30 11:00

    Seems that one of the places where it's best defined is in Romain Guy's Blog:

    The DecorView is the view that actually holds the window’s background drawable. Calling getWindow().setBackgroundDrawable() from your Activity changes the background of the window by changing the DecorView‘s background drawable. As mentioned before, this setup is very specific to the current implementation of Android and can change in a future version or even on another device.

    0 讨论(0)
提交回复
热议问题