使用AnimationFactory.Java outToLeftAnimation

使用AnimationFactory.Java outToLeftAnimation,java,android,Java,Android,我正在使用AnimationFactory.Java的创建者提供的方法。我不知道如何实现这两种方法 我想滑出一个片段,滑入另一个片段 以下是我尝试使用的方法: * Slide animations to hide a view by sliding it to the left. * * @param duration the animation duration in milliseconds * @param interpolator the interpolator to use

我正在使用AnimationFactory.Java的创建者提供的方法。我不知道如何实现这两种方法

我想滑出一个片段,滑入另一个片段

以下是我尝试使用的方法:

 * Slide animations to hide a view by sliding it to the left.
 *
 * @param duration the animation duration in milliseconds
 * @param interpolator the interpolator to use (pass {@code null} to use the {@link AccelerateInterpolator} interpolator)
 * @return a slide transition animation
 */
public static Animation outToLeftAnimation(long duration, Interpolator interpolator) {
    Animation outtoLeft = new TranslateAnimation(
            Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,  -1.0f,
            Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,   0.0f
    );
    outtoLeft.setDuration(duration);
    outtoLeft.setInterpolator(interpolator==null?new AccelerateInterpolator():interpolator);
    return outtoLeft;
}


 * Slide animations to enter a view from right.
 *
 * @param duration the animation duration in milliseconds
 * @param interpolator the interpolator to use (pass {@code null} to use the {@link AccelerateInterpolator} interpolator)
 * @return a slide transition animation
 */
public static Animation inFromRightAnimation(long duration, Interpolator interpolator) {

    Animation inFromRight = new TranslateAnimation(
            Animation.RELATIVE_TO_PARENT,  +1.0f, Animation.RELATIVE_TO_PARENT,  0.0f,
            Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,   0.0f
    );
    inFromRight.setDuration(duration);
    inFromRight.setInterpolator(interpolator==null?new AccelerateInterpolator():interpolator);
    return inFromRight;
}
有人知道如何使用这些方法吗

谢谢