I'm trying to implement the sliding animation to transit from fragment1 to fragment2, like this image.
Firstly, I tried to implement xml with set and translate, but I got RuntimeException "Unknown animator name translate".
<?xml version="1.0" encoding="utf-8"?>
<set
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:interpolator="@android:anim/accelerate_interpolator">
     <translate
       android:fromXDelta="0%p"
       android:toXDelta="-100%p"
       android:duration="500">
     </translate>
</set>
Secondly, I tried to solve problem by using a class that extends framelayout, and add "getXFraction" and "setXFraction" method, like this post
public class SlidingFrameLayout extends FrameLayout
{
    private static final String TAG = SlidingFrameLayout.class.getName();
    public SlidingFrameLayout(Context context) {
        super(context);
    }
    public SlidingFrameLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    public float getXFraction()
    {
        final int width = getWidth();  
        if(width != 0) return getX() / getWidth();  
        else return getX();  
    }
    public void setXFraction(float xFraction) {
        final int width = getWidth();  
        setX((width > 0) ? (xFraction * width) : -9999);  
    }
    public float getYFraction()
    {
        final int height = getHeight();  
        if(height != 0) return getY() / getHeight(); else return getY();   
    }
    public void setYFraction(float yFraction) {
        final int height = getHeight();  
        setY((height > 0) ? (yFraction * height) : -9999);  
    }
}
But I still don't know How should I use SlidingFrameLayout? Please help me. T___T
 
     
     
    