Ada*_*gyi 5 android android-fragments
是否有任何方法替换片段FragmentTransaction's replace,而不是将其添加到历史堆栈?
我只想让我的应用程序不记得它,当我按下按钮时.
Orh*_*but 12
当您使用FragmentTransaction添加片段时,会有addToBackStack选项,如果您不使用它,它将不在堆栈中.
// it won't add to stack
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
// fragment will be added to stack
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.addToBackStack("placeholder")
commit();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3972 次 |
| 最近记录: |