How to get Activity's content view?

前端 未结 8 772
一向
一向 2020-11-27 09:22

What method should I call to know if an Activity has its contentView (once the method setContentView() has been called)?

8条回答
  •  青春惊慌失措
    2020-11-27 10:17

    this.getWindow().getDecorView().findViewById(android.R.id.content)
    

    or

    this.findViewById(android.R.id.content)
    

    or

    this.findViewById(android.R.id.content).getRootView()
    

提交回复
热议问题