[Solved] How to get current layout on android? [closed]


Try these:

View currentView = this.getWindow().getDecorView().findViewById(android.R.id.content)

or

View currentView = this.findViewById(android.R.id.content)

or

View currentView = this.findViewById(android.R.id.content).getRootView()

or

You can get the view if you put an id to each of your layout file’s root tag like below:

<RelativeLayout
    android:id="@+id/rl_root_one"

And then get the view:

RelativeLayout relativeLayout = (RelativeLayout)findViewById(R.id.rl_root_one);

Using any of the above methods you can get the current View inflated.

solved How to get current layout on android? [closed]