左安卓观看动画权 [英] View animation right to left android
本文介绍了左安卓观看动画权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不能够把视图动画膨胀的布局。
我用下面的code段
和XML
<设置的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:shareInterpolator =假>
<翻译Android:fromXDelta =0%安卓toXDelta =100%
机器人:fromYDelta =0%安卓toYDelta =0%
机器人:时间=700/>< /集>
是什么东西不见了?
感谢。
解决方案
下面是code为视图,滑动动画。
1)inFromRightAnimation 私人动画inFromRightAnimation(){ 动画inFromRight =新TranslateAnimation(
Animation.RELATIVE_TO_PARENT,+ 1.0F,
Animation.RELATIVE_TO_PARENT,0.0,
Animation.RELATIVE_TO_PARENT,0.0,
Animation.RELATIVE_TO_PARENT,0.0);
inFromRight.setDuration(500);
inFromRight.setInterpolator(新AccelerateInterpolator());
返回inFromRight;
} 2)outToLeftAnimation
私人动画outToLeftAnimation(){
动画outtoLeft =新TranslateAnimation(
Animation.RELATIVE_TO_PARENT,0.0,
Animation.RELATIVE_TO_PARENT,-1.0F,
Animation.RELATIVE_TO_PARENT,0.0,
Animation.RELATIVE_TO_PARENT,0.0);
outtoLeft.setDuration(500);
outtoLeft.setInterpolator(新AccelerateInterpolator());
返回outtoLeft;
}3)inFromLeftAnimation 私人动画inFromLeftAnimation(){
动画inFromLeft =新TranslateAnimation(
Animation.RELATIVE_TO_PARENT,-1.0F,
Animation.RELATIVE_TO_PARENT,0.0,
Animation.RELATIVE_TO_PARENT,0.0,
Animation.RELATIVE_TO_PARENT,0.0);
inFromLeft.setDuration(500);
inFromLeft.setInterpolator(新AccelerateInterpolator());
返回inFromLeft;
}4)outToRightAnimation 私人动画outToRightAnimation(){
动画outtoRight =新TranslateAnimation(
Animation.RELATIVE_TO_PARENT,0.0,
Animation.RELATIVE_TO_PARENT,+ 1.0F,
Animation.RELATIVE_TO_PARENT,0.0,
Animation.RELATIVE_TO_PARENT,0.0);
outtoRight.setDuration(500);
outtoRight.setInterpolator(新AccelerateInterpolator());
返回outtoRight;
}
和现在看动画启动
pageView.startAnimation(inFromRightAnimation());
谢谢,
I am not able to put view animation for inflated layouts. I used the following code snippet
pageView.startAnimation(AnimationUtils.loadAnimation(this,R.anim.right_to_left_anim.xml));
and xml
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate android:fromXDelta="0%" android:toXDelta="100%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="700"/>
</set>
Is any thing i missing?
Thanks.
解决方案
Here is the code for the sliding animation for view.
1)inFromRightAnimation
private Animation inFromRightAnimation() {
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(500);
inFromRight.setInterpolator(new AccelerateInterpolator());
return inFromRight;
}
2)outToLeftAnimation
private Animation outToLeftAnimation() {
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(500);
outtoLeft.setInterpolator(new AccelerateInterpolator());
return outtoLeft;
}
3)inFromLeftAnimation
private Animation inFromLeftAnimation() {
Animation inFromLeft = 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);
inFromLeft.setDuration(500);
inFromLeft.setInterpolator(new AccelerateInterpolator());
return inFromLeft;
}
4)outToRightAnimation
private Animation outToRightAnimation() {
Animation outtoRight = 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);
outtoRight.setDuration(500);
outtoRight.setInterpolator(new AccelerateInterpolator());
return outtoRight;
}
and now start Animation on view
pageView.startAnimation(inFromRightAnimation());
Thanks,
这篇关于左安卓观看动画权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文