android - 如何在没有动画的情况下滚动水平 ScrollView

标签 android animation scrollview

问题是我正在使用 fullScroll()scrollTo() 函数来滚动,但它是动画的,我需要它在没有用户观察的情况下发生。

有没有办法解决这个问题?

hScrollView.post(new Runnable() {
    @Override
    public void run() {
        hScrollView.fullScroll(HorizontalScrollView.FOCUS_RIGHT);
    }
});

最佳答案

使用这个

// Disable the animation First
hScrollView.setSmoothScrollingEnabled(false);
// Now scroll the view
hScrollView.fullScroll(HorizontalScrollView.FOCUS_RIGHT);
// Now enable the animation again if needed
hScrollView.setSmoothScrollingEnabled(true);

关于android - 如何在没有动画的情况下滚动水平 ScrollView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11210124/

相关文章:

Android处理一段视频,YCrCb帧转视频

css - 这种发光效果可能吗?

ios - 仅在 UITableViewCell 中禁用 UIScrollView 的垂直滚动

swift - 在 ScrollView 中嵌入 PageViewController - 以编程方式 Swift 5

Android uber 错误 No authentication challenges found

java - 解析数据org.json.JSONException : Expected ':' after n时出错

android - 用opencv处理Android图像

javascript - 使用 Jquery 和 '.css' 的 CSS 动画

animation - react 原生动画 : Spring Speed

android - 当它通过顶部时使 View 固定在顶部