I create a programatically toolbar, and I want to add it to my activity at the top, without putting id in my xml layout.
I can add the view at the top but the problem is that it goes over the views of the layout. I want that when I add it all the layout goes below my toolbar. I try to do it in a generic way.
To summarize in my layout xml I have my Relative layout (but it could be something else linear layout, I want it to be generic). And in my code I want to add it to my relativelayout
val toolbar = PrimaryToolbar(context = this, title = "Title")
val viewGroup: ViewGroup = this.findViewById(android.R.id.content)
viewGroup.addView(toolbar, 0)