【问题标题】:Is there a way to set the vertical scroll postion of a scroll view on android 2.0? [duplicate]有没有办法在 android 2.0 上设置滚动视图的垂直滚动位置? [复制]
【发布时间】:2012-06-23 02:33:04
【问题描述】:

可能重复:
Can I scroll a ScrollView programmatically in Android?

我有一个聊天程序,可以将聊天添加到滚动视图内的文本视图中。底部代表最后一次聊天。我想拥有它,所以每次添加新的 chts 时,它都会向下滚动。

当我查看 sdk 时,有一个名为 setVerticalScrollPos 的函数,但文档说它需要 sdk 11,即 android 3.0。

问号, 1.有没有办法在android 2.0中设置垂直滚动位置 2.目前我的开发环境设置为android 3.0,(因为广告)但我的目标市场是2.0及以上。我在我的 2.0 的 android 设备上测试运行它。我的代码在 android 2.2 上运行时可以调用 setVerticalScrollPos 吗?或者也许我可以有一个 if then 只为 android 3.0 或更高版本的设备调用该方法?

【问题讨论】:

    标签: android


    【解决方案1】:

    SDK 中没有方法叫setVerticalScrollPos(),即使在 3.0 中,但没关系。

    scrollTo()smoothScrollTo() 从一开始就在 SDK 中,可以在任何视图上调用(平滑变体为滚动设置动画)。

    HTH

    【讨论】:

    • 您好,感谢您抽出宝贵时间帮助我!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-18
    相关资源
    最近更新 更多