我有点怀疑。
我有一个 Activity ,里面有 3 个 fragment 。我需要重新启动这些 fragment 之一的状态。 只重启一个。
最佳答案
旧的,但可能对其他人有用。要刷新 fragment ,需要分离 fragment 并重新附加它
Fragment frg = null;
frg = getFragmentManager().findFragmentByTag("Your_Fragment_TAG");
final FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.detach(frg);
ft.attach(frg);
ft.commit();
Your_Fragment_TAG 是您在创建 fragment 时为其指定的名称
关于android - 重新启动 Activity 中的 fragment ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13989300/