我正在使用Android Studio实现一个应用程序,并创建了一个 Select 背景的活动.如果我使用我已经意识到的导航按钮,一切都很好,但如果我在后台活动中按下系统向后箭头,图像会变小,并且不会覆盖整个屏幕(如下所示).我try 在onResume()函数中重置背景,然后取消它,但没有起作用. 下面是onResume()函数的代码以及后台是如何实现的 希望问题清楚了
<FrameLayout
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"
tools:context=".MainActivity"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imgBg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:background="@drawable/background0" />
<androidx.constraintlayout.widget.ConstraintLayout
...
@Override
protected void onResume() {
super.onResume();
//Gestione sfondo
ImageView bg = findViewById(R.id.imgBg);
bg.setBackground(MainActivity.bgs.getActive());
bg.invalidate();
}
When you first open it is like this个
Then you select a new background and it opens this个
But if you press the backarrow on the left of the system nav bar it happens this个