android android.R.id.content返回null

setContentView(R.layout.act_main)后,
执行代码View cv = getWindow().getDecorView().findViewById(android.R.id.content);
返回null

请问是什么原因?

img

一样的写法

你要获取的是布局中的控件?还是系统自带的控件?
如果是当前布局的控件,findViewById(android.R.id.content);这样就可以找到