put one parent layout for your Relative Layout and give it fill_parent
for android:layout_width
and android:layout_height
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
>
// your entire layout and no need to set gravity for your child relative layout.
</RelativeLayout>
and now no need to set gravity for your child RelativeLayout
even for window.
and yes make your parent view background to transparent:
android:background="@android:color/transparent"