Minimize the application. In the minimized application manager, the last state of the activity is displayed before it is minimized. How can I change the background that is displayed?

Разметка: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="20dp" android:text="text" android:textColor="#000" /> </LinearLayout> <FrameLayout android:id="@+id/frameID" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000" android:visibility="visible" /> </RelativeLayout> 

Activity code:

 @Override protected void onResume() { super.onResume(); frameLayout.setVisibility(View.GONE); } @Override protected void onStop() { frameLayout.setVisibility(View.VISIBLE); super.onStop(); } 

I would like that when you turn off the application, there was a dark background. Tried to do it in onStop. But the system apparently makes a screen screen earlier.

    1 answer 1

    In the onStop method, change the “background” to the one you want, and when you expand onResume, change it back (if I understood your question correctly).

    • Tried to do: @Override protected void onStop () {frameLayout.setVisibility (View.VISIBLE); super.onStop (); } Apparently the system makes a screenshot. earlier because the wrong result is displayed - beg_android
    • Perhaps you can somehow set the system? - beg_android
    • @beg_android if you added code it would be easier to help. It is not entirely clear what particular result you want to achieve. - Eugene Troyanskii
    • added code above - beg_android
    • @beg_android and you can see it if you don’t make GONE in onResume? You just kind of freaked out .. And LinearLayout i RelativeLayout i FrameLayout .. - Eugene Troyanskii