Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 放置在线性布局中的文本视图上的动画_Android_Animation_View_Textview_Scaleanimation - Fatal编程技术网

Android 放置在线性布局中的文本视图上的动画

Android 放置在线性布局中的文本视图上的动画,android,animation,view,textview,scaleanimation,Android,Animation,View,Textview,Scaleanimation,我需要在布局内的文本视图上实现动画 我的要求是,, 我需要在屏幕上显示三个文本视图 "Title1(left of the screen) Title2(center) Title3(right of the screen)". 当用户单击文本“Title3”时,我需要显示 Title2(at left) Title3(at center) and Title4(at right). 然后,当我们点击“标题4”时,它会显示出来 标题3位于左侧标题4位于中心,标题1位于右侧,就像旋

我需要在布局内的文本视图上实现动画

我的要求是,, 我需要在屏幕上显示三个文本视图

"Title1(left of the screen)  Title2(center)   Title3(right of the screen)".
当用户单击文本“Title3”时,我需要显示

 Title2(at left)   Title3(at center) and Title4(at right).
然后,当我们点击“标题4”时,它会显示出来

标题3位于左侧标题4位于中心,标题1位于右侧,就像旋转一样。我们如何实现这样的动画,

这是我的密码

在onclick中,我在下面的几行中调用了缩放动画

tv3.setAnimation(AnimationUtils.loadAnimation(mContext, R.anim.right_to_left));
tv2.setAnimation(AnimationUtils.loadAnimation(mContext, R.anim.right_to_left));
tv1.setAnimation(AnimationUtils.loadAnimation(mContext, R.anim.right_to_left));
tv3.getAnimation().setAnimationListener(flipperAnimationListener);
下面是我的动画监听器

flipperAnimationListener = new AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }
            @Override
            public void onAnimationRepeat(Animation animation) {}
            @Override
            public void onAnimationEnd(Animation animation) {
                changeTab();
            }
        };

你为什么不使用ViewPager?它包含你想要的东西

下面是一个例子:

这是ViewPager的一个示例:

要激活PagerTitle,只需覆盖getPageTitle:

@Override
public CharSequence getPageTitle(int position) {
return "Title " + position;
}

你的意思是像这样的卡片翻转动画吗?不,不是那样的,它的缩放动画,这意味着当我们点击第3页时,第1页将隐藏,第2页,第3页和第4页将显示在屏幕上等等。你得到了什么结果?在动画之后,文本发生了变化,所以有一个延迟。是的,你是对的,我已经尝试过了,但我需要一个循环动画,这意味着在第4页之后,我需要第1页作为下一个选项卡。有什么办法吗??