Overdraw and Romain Guy's blog post Android Performance Case Study

后端 未结 1 983
眼角桃花
眼角桃花 2021-02-01 08:22

Based upon Romain Guy\'s blog post Android Performance Case Study when talking about Overdraw he says this:

Removing the window background: the backgroun

相关标签:
1条回答
  • 2021-02-01 08:48

    Just move getWindow().setBackgroundDrawable(null) down, until anywhere after setContentView(R.layout.main); e.g.:

    @Override public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        getWindow().setBackgroundDrawable(null);
    }
    

    The setContentView(...) call propagates setting the content on the window the activity is attached to and probably overrides the change you meant to made with setBackgroundDrawable(null).

    Result:

    enter image description here

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