If this happened after setting targetsdk to 35 & beyond then add following line to you layout.xml :
android:fitsSystemWindows="true"