手机从竖屏切换到横屏,再从横屏切回竖屏。会出现留白的问题。
查了半天发现是布局的问题,这是布局中原来的代码。
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@drawable/base_main_background">
</>
要去掉 android:fitsSystemWindows=“true”。去掉之后就没有问题了。
关于android:fitsSystemWindows="true"的用法,我就不写了,直接推荐一篇博客