Set Root view of activity

I wanna to know if can able to set any view to root view of activity(parent of whole activity.) , How?

For example :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

        <EditText
            android:id="@+id/review_box"
            android:layout_width="match_parent"
            android:layout_height="80dp"
            android:layout_below="@id/rating_bar"
            android:layout_margin="24dp"
            android:background="@drawable/rounded_bg"
            android:hint="Write your Review"
            android:padding="12dp" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/review_box"
            android:layout_margin="24dp"
            android:text="Submit"
            android:elevation="4dp"
            android:background="@color/colorPrimary"/>
    </RelativeLayout>

How can I set RelativeLayout or any view to be parent of whole activity like this example (by code) ?

View rootView = container.$context().getWindow().getDecorView().getRootView();

this code that enables us to get root view like view , any idea how to replace it with another view?

activity.setContentView(yourView) may help