Android FragmentTransaction Custom Animation (Unknown Animator Name: Translate)

I’m trying to get a custom animation to work with my fragment.

I’ve followed the online tutorials but I’ve been getting the below error:

  • Invisible ActionMode item icons in Theme.Sherlock.Light.DarkActionBar
  • Make voice and video call through internet with our application?
  • Error using Android Design Support Library: attr backgroundTint not found
  • Android EditText/TextView how to make each word start with uppercase and all remaining characters of words to be lowercase
  • Slowing speed of Viewpager controller in android
  • How can I find out the camera images folder of an Android phone?
  • java.lang.RuntimeException: Unknown animator name: translate

    The XML for the animation is below:

    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="">
        android:duration="300" />

    The Java file is shown below:

    public void goCategory(View v) {        
        FragmentTransaction ft = fm.beginTransaction();     
        ft.setCustomAnimations(R.animator.anim_in_left, R.animator.anim_out_left);             ;

    I’m having trouble understanding the solutions in the other threads.
    If someone could dumb it down for me, I’d really appreciate it.


  • How to change the proguard mapping file name in gradle for Android project
  • How to get data from each dynamically created EditText in Android?
  • Storing a password
  • Android Device Chooser Shows Red X In Target Column
  • Android: Launch activity from clickable text
  • Clear text in EditText when entered
  • 3 Solutions collect form web for “Android FragmentTransaction Custom Animation (Unknown Animator Name: Translate)”

    It will not work, you should use object animator


    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="" >
            android:valueType="floatType" />


    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="" >
            android:valueType="floatType" />

    Class Subcategory

     public View onCreateView(LayoutInflater inflater, ViewGroup container,
                    Bundle savedInstanceState) {
                // TODO Auto-generated method stub
                // return super.onCreateView(inflater, container, savedInstanceState);
                View view = (ViewGroup) inflater.inflate(R.layout.product_frame, null);
                        .replace(, new Sub_Header()).commit();
                                R.animator.slide_out_right, 0, 0)
                        .replace(, new Sub_Catagory_Grid()).commit();
                return view;

    Probably you are mixing two apis. There are two cases:

    • If targeting below 3.0 or using support v4 fragments: You have to use the old animations api, that is, the one you are using (they go into anim/, and are R.anim.thing)

    • If you are targeting above 3.0 and using native fragments: You have to use the new animation apis, that is, ObjectAnimators (they go into animator/ and are R.animator.thing).

    As @minivac replied you are mixing two APIs. Please, take a look to Display Card Flip Animations example from Android training guides to get a further understanding about how to add custom animations to fragment transactions. It solves exactly your issue.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.