FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right); DetailsFragment newFragment = DetailsFragment.newInstance(); ft.replace(R.id.details_fragment_container, newFragment, "detailFragment"); // Start the animated transition. ft.commit();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right); ft.replace(R.id.fragment_container, newFragment, "fragment"); // Start the animated transition. ft.commit();
FragmentTransaction transaction = manager.beginTransaction(); transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right); transaction.replace(R.id.content, myFragment); transaction.commit();
FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.pop_exit); CustomFragment newCustomFragment = CustomFragment.newInstance(); transaction.replace(R.id.fragment_container, newCustomFragment ); transaction.addToBackStack(null); transaction.commit();
@SuppressLint("CommitTransaction") private static FragmentTransaction defaultTransaction(FragmentManager fragmentManager) { return fragmentManager.beginTransaction() .setCustomAnimations(R.animator.custom_fade_in, R.animator.custom_fade_out, R.animator.custom_fade_in, R.animator.custom_fade_out); }
public void replaceFragmentWithAnimation(android.support.v4.app.Fragment fragment, String tag){ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left); transaction.replace(R.id.fragment_container, fragment); transaction.addToBackStack(tag); transaction.commit(); }
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.setCustomAnimations(R.anim.in_from_left, R.anim.out_to_right, R.anim.in_from_right, R.anim.out_to_left); ft.replace(android.R.id.content, newFrag); ft.addToBackStack(null); ft.commit();
... FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out, android.R.animator.fade_in, android.R.animator.fade_out); anomalieFragment = new AnomalieListFragment(); ft.replace(R.id.content, anomalieFragment); ft.addToBackStack(null); ft.commit(); ...
FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); MyFragment next = getMyFragment(); ft.add(R.id.MyLayout,next); ft.setCustomAnimations(R.anim.slide_in_right,0); ft.show(next); ft.commit();
@Override public void onListClicked(long id) { getSupportFragmentManager().beginTransaction() .setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left, R.anim.slide_in_left, R.anim.slide_out_right) .replace(android.R.id.content, ItemsFragment.newInstance(id)) .addToBackStack(null) .commit(); }
@TargetApi(21) public static void navigateToAlbum(Activity context, long albumID, Pair<View, String> transitionViews) { FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager().beginTransaction(); Fragment fragment; transaction.setCustomAnimations(R.anim.activity_fade_in, R.anim.activity_fade_out, R.anim.activity_fade_in, R.anim.activity_fade_out); fragment = AlbumDetailFragment.newInstance(albumID, false, null); transaction.hide(((AppCompatActivity) context).getSupportFragmentManager().findFragmentById(R.id.fragment_container)); transaction.add(R.id.fragment_container, fragment); transaction.addToBackStack(null).commit(); }
@TargetApi(21) public static void navigateToArtist(Activity context, long artistID, Pair<View, String> transitionViews) { FragmentTransaction transaction = ((AppCompatActivity) context).getSupportFragmentManager().beginTransaction(); Fragment fragment; transaction.setCustomAnimations(R.anim.activity_fade_in, R.anim.activity_fade_out, R.anim.activity_fade_in, R.anim.activity_fade_out); fragment = ArtistDetailFragment.newInstance(artistID, false, null); transaction.hide(((AppCompatActivity) context).getSupportFragmentManager().findFragmentById(R.id.fragment_container)); transaction.add(R.id.fragment_container, fragment); transaction.addToBackStack(null).commit(); }
@Override public boolean onPreferenceStartFragment(PreferenceFragmentCompat caller, Preference preference) { Fragment fragment = Fragment.instantiate(this, preference.getFragment(), preference.getExtras()); getSupportFragmentManager().beginTransaction() .setCustomAnimations(R.animator.custom_fade_in, R.animator.custom_fade_out, R.animator.custom_fade_in, R.animator.custom_fade_out) .replace(R.id.fragment_holder, fragment) .addToBackStack(null) .commit(); return true; } }
@Override public void showAboutFragment() { lockDrawer(); getSupportFragmentManager() .beginTransaction() .disallowAddToBackStack() .setCustomAnimations(R.anim.slide_left, R.anim.slide_right) .add(R.id.cl_root_view, AboutFragment.newInstance(), AboutFragment.TAG) .commit(); }
/** * Pushes a fragment to the top of the stack. */ public void push(Fragment fragment) { Fragment top = peek(); if (top != null) { manager.beginTransaction() .setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right) .remove(top) .add(containerId, fragment, indexToTag(manager.getBackStackEntryCount() + 1)) .addToBackStack(null) .commit(); } else { manager.beginTransaction() .add(containerId, fragment, indexToTag(0)) .commit(); } manager.executePendingTransactions(); }
@Override public void onFragmentDetached(String tag) { FragmentManager fragmentManager = getSupportFragmentManager(); Fragment fragment = fragmentManager.findFragmentByTag(tag); if (fragment != null) { fragmentManager .beginTransaction() .disallowAddToBackStack() .setCustomAnimations(R.anim.slide_left, R.anim.slide_right) .remove(fragment) .commitNow(); unlockDrawer(); } }
transaction.setCustomAnimations(R.anim.scene_open_enter, R.anim.scene_open_exit);
next.setExitTransition(null); transaction.setCustomAnimations(R.anim.scene_close_enter, R.anim.scene_close_exit);
transaction.setCustomAnimations(R.anim.scene_open_enter, R.anim.scene_open_exit); newScene.setExitTransition(null); transaction.setCustomAnimations(R.anim.scene_open_enter, R.anim.scene_open_exit);
switch (op.cmd) { case OP_ADD: { ft.setCustomAnimations(op.enterAnim, op.exitAnim); ft.add(op.containerViewId, op.fragment, op.fragmentTag); ft.setCustomAnimations(op.enterAnim, op.exitAnim); Fragment f = find(op.fragmentTag); if (f == null) { ft.setCustomAnimations(op.enterAnim, op.exitAnim); Fragment f = find(op.fragmentTag); if (f == null) {