HorizontalScrollView,自动滚动到末尾并带有动画效果

7

我有一个HorizontalScrollView,当我加载视图时,我需要通过动画自动滚动到末尾。我已经实现了以下方法来实现它:

final HorizontalScrollView strip = (HorizontalScrollView) contentView.
    findViewById(R.id.horizontalScrollView1);

strip.postDelayed(new Runnable() {

    public void run() {
        strip.fullScroll(HorizontalScrollView.FOCUS_RIGHT);
    }
}, 1000L);

它运行良好,但是主要问题在于滚动的动画太快了,我需要实现一个更慢的滚动。你有什么想法吗?

2个回答

6
这是我为我的一个项目创建的演示项目。它是一个自动和连续滚动的滚动条,旨在通过不断滚动一系列图像来显示信用屏幕。这可能会对您有所帮助或给您一些想法。 https://github.com/blessenm/SlideshowDemo

太棒了!谢谢!真的帮了大忙! - ashabasa

5

试试这个:

ObjectAnimator animator=ObjectAnimator.ofInt(buttonHolderScrollView, "scrollX",targetXScroll );
animator.setStartDelay(100);
animator.setDuration(100);
animator.start();

如果您想要滚动到底部,请使用 targetXScroll = horizontalScrollView.right - Fori

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接