Use this Concept said by AgentP and this works for me:-
give id to your realtive layout say:-
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00212121"
android:id="@+id/parent_layout"
tools:context=".MainActivity">
//some code here
</RelativeLayout>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…