Android:如何在顶部滚动ScrollView [英] Android: How to scroll ScrollView in top

查看:89
本文介绍了Android:如何在顶部滚动ScrollView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个按钮可以切换到下一个事件列表和上一个事件列表.

I have two buttons that switching to the next list of events and the previous one.

当我转到下一个\上一个事件时,滚动条将保留在下面的某个位置.但是我需要倒带"它.

When I go to next\previous event, scrolls remains somewhere below. But I need to "rewind" it up.

我正在尝试:

scrollViewEventDetails.pageScroll(ScrollView.FOCUS_UP);

和:

scrollViewEventDetails.scrollTo(0, 0); 

但是它不起作用.请帮忙!

but it doesn't work. Please, help!

推荐答案

您应该接着写:

scrollViewEventDetails.fullScroll(View.FOCUS_UP);//if you move at the end of the scroll

scrollViewEventDetails.pageScroll(View.FOCUS_UP);//if you move at the middle of the scroll

这篇关于Android:如何在顶部滚动ScrollView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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