How do I get the content view of the activity?

Asked 2 years ago, Updated 2 years ago, 22 views

I have a question. There's a setContentView in Android activities. then How do you get the view that the activity has?

android

2022-09-22 11:45

1 Answers

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

I

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

I

this.findViewById(android.R.id.content).getRootView() You can do it in this way.


2022-09-22 11:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.