Android的动画相似,使垂直滚动字幕 [英] Android Animations similar to make marquee vertical

查看:562
本文介绍了Android的动画相似,使垂直滚动字幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个基本问题道歉,因为我是一个完整的新手到Android:

Apologies for this basic question, as I'm a complete novice to Android:

我可以让我的的TextView 水平滚动的一行。

I can make my TextView scroll horizontally on one line.

不过,我需要的是多个 TextViews ,这在选取框的方式全部滚动的纵向以屏幕的底部,然后备份到顶部。

But what I need is multiple TextViews, which in a marquee fashion all scroll vertically to the bottom of the screen and then back up to the top.

我一直在寻找了几个小时,不能看,似乎要做到这一点了Android API的任何东西。

I've been searching for hours and cannot see anything in the android API that seems to do this.

还是有一个动画功能,可以做到这一点?

Or is there an animation feature that can accomplish this?

推荐答案

请参阅本 GitHub的项目它有它一个很好的例子了。

refer this GitHub Project it has a wonderful example in it too.

编辑:
让XML的一些事情是这样的:

make your xml some thing like this:

<com.package.project.VerticalMarqueeTextView
android:id="@+id/vmTextView"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/vmtvText"
android:minLines="1"
android:maxLines="10"
android:width="250dp"
android:textColor="@android:color/white"
android:textStyle="bold" />

在您的活动类:

private VerticalMarqueeTextView _txtView1; //declare a member variable

的onCreate()

_txtView1 = (VerticalMarqueeTextView) findViewById(R.id.mTextView1);
_txtView1.setMovementMethod(new ScrollingMovementMethod());

和其他活动的生命周期方法:

And in other activity lifecycle methods:

@Override
protected void onResume() {

    // Start or restart the Marquee if paused.
    if (_txtView1.isPaused()) {
        _txtView1.resumeMarquee();
    }
    super.onResume();
}

@Override
protected void onPause() {

    // Pause the Marquee when the Activity pauses.
    _txtView1.pauseMarquee();
    super.onPause();
}

@Override
protected void onDestroy() {

    _txtView1.stopMarquee();
    super.onDestroy();
}

这篇关于Android的动画相似,使垂直滚动字幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆