android. R. id. content will give the entire view of the present activity.
Actually setContentView() is a method part of android. app. Activity class. It helps to set our content or render our layout on the screen. Based on the value given by the user, views will be inflated and rendered after the measurement of the screen, root view, and its child views.
this.getWindow().getDecorView().findViewById(android.R.id.content)
or
this.findViewById(android.R.id.content)
or
this.findViewById(android.R.id.content).getRootView()
You can get the view Back if you put an ID to your Layout.
<RelativeLayout
android:id="@+id/my_relative_layout_id"
And call it from findViewById ...
How about
View view = Activity.getCurrentFocus();
You may want to try View.getRootView()
.
You can also override onContentChanged()
which is among others fired when setContentView()
has been called.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With