如果我使用android.support.v4.app.Fragment,如何使用replace()方法

时间:2015-07-25 07:05:45

标签: java android

有什么方法可以在'android.support.v4.app.Fragment'片段中使用replace()方法吗?

1 个答案:

答案 0 :(得分:1)

只需使用getFragmentManager()代替Fragment fragment = new Fragment(); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(fragment, "Fragment_tag").commit();

例如

using SomeProject.LayerB; namespace SomeProject.LayerA; { public class AppService { private readonly ISomeRepository someRepository; public LocationManagementService(ISomeRepository someRepository) { this.someRepository = someRepository; } // other codes ... } }