Android FragmentTransaction Custom Animation (Unknown Animator Name: Translate)

后端 未结 3 1649
无人及你
无人及你 2020-11-29 21:58

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:

java.lang

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 22:26

    It will not work, you should use object animator

    animator/slide_in_left.xml

    
    
    
        
    
    
    

    animator/slide_out_right.xml

    
    
    
        
    
    
    

    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);
                getFragmentManager().beginTransaction()
                        .replace(R.id.sub_header, new Sub_Header()).commit();
                getFragmentManager()
                        .beginTransaction()
                        .setCustomAnimations(R.animator.slide_in_left,
                                R.animator.slide_out_right, 0, 0)
                        .replace(R.id.product_frame, new Sub_Catagory_Grid()).commit();
    
                view.getWidth();
                return view;
    
            }
    

提交回复
热议问题