我可以在Android中滚动滚动型编程? [英] Can I scroll a ScrollView programmatically in Android?

查看:140
本文介绍了我可以在Android中滚动滚动型编程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么办法可以滚动滚动型编程到一定的位置?

TableLayout

我创建动态这是摆在一个滚动型。所以,我想这对一个特定的动作(如点击一个按钮等)的特定行应自动滚动到顶部位置。

这可能吗?

解决方案

 滚动型SV =(滚动型)findViewById(R.id.scrl);
sv.scrollTo(0,sv.getBottom());
 

sv.scrollTo(5,10);

Is there any way to scroll a ScrollView programmatically to a certain position?

I have created dynamic TableLayout which is placed in a ScrollView. So I want that on a specific action (like clicking a Button, etc.) the particular row should scroll automatically to a top position.

Is it possible?

解决方案

ScrollView sv = (ScrollView)findViewById(R.id.scrl);
sv.scrollTo(0, sv.getBottom());

or

sv.scrollTo(5, 10);

这篇关于我可以在Android中滚动滚动型编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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