How to get root ViewGroup from a layout that was set using setContentView?
android
Solution
Try using
ViewGroup view = (ViewGroup) findViewById(android.R.id.content);
Every layout has this ViewGroup as parent.
Problem
I cannot seem to find a way to get this ViewGroup. Not sure if there are any standard ways to get ViewGroups. What I want to accomplish is to dynamically add a full screen overlay view to any Layout at run time, and in order to do this, I always need to get the root ViewGroup. Is this the right way to do this?