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

时间:2014-10-31 05:53:44

标签: android animation view textview scaleanimation

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

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

"Title1(left of the screen)  Title2(center)   Title3(right of the screen)".

当用户点击我需要显示的文字'Title3'

 Title2(at left)   Title3(at center) and Title4(at right).

然后当我们点击'Title4'时,它会显示

Title3(at left) Title4(at center) and Title1(at right)喜欢轮换。我们如何实现这种动画,

这是我的代码,

在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();
            }
        };

1 个答案:

答案 0 :(得分:0)

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

以下是一个示例:https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSFjdgbbZGqUzaWTmm7Rvj4OtRx2oWnHfBYghwwmRIoStKLnzfLAg

这是ViewPager的一个示例:http://developer.android.com/training/animation/screen-slide.html

要激活“PagerTitleStrip”,只需覆盖getPageTitle:

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