- Fragment回退栈(getFragmentManager().beginTransaction().replace(R.id.fl_container,bFragment).addToBackStack(null).commitAllowingStateLoss();)
AFragment
package com.example.test0508.fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.example.test0508.R;
public class AFragment extends Fragment {
private TextView mTvTitle;
private Button mBtnChange;
private Button mBtnReset;
private BFragment bFragment;
//想要可以传参,写一个静态方法
public static AFragment newInstance