addToBackStack(String.valueOf (index)) 不起作用

问题描述

你好,我试图包含一个带有索引的 bacstack 作为布局,但不知道为什么它不起作用 以前我多次使用相同的方法,但这次不起作用

我得到的是当我按下它时它假设返回到我在后台提到的 Profile_Fragment 但它会返回 HomeFragment 不知道为什么

只是提到按钮 editProfileButton 位于另一个包含在 ProfileFragment 中的布局

如果你想要更多的代码参考,请告诉我我会更新 完整代码问题

配置文件片段

 RelativeLayout relativeLayout = view.findViewById(R.id.snipet_profile);
    editProfileButton = relativeLayout.findViewById(R.id.edit_profile_button);
            editProfileButton.setonClickListener(v -> {
                Fragment edit_profile = new Edit_Profile();
                FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
                transaction.replace(R.id.fragment_container,edit_profile);
                transaction.addToBackStack(String.valueOf(new Profile_Fragment()));
                transaction.commit();
            });

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)