【问题标题】:Continuously Auto-Scrolling ListView连续自动滚动 ListView
【发布时间】:2011-09-22 18:25:01
【问题描述】:

我在 Android 中有一个 Listview。我希望Listview 自己不断地从上到下滚动。它应该无限发生

显然我想捕获对Listview 的任何项目的点击,发布滚动将继续

任何有这种实现经验的人。请帮忙!!

【问题讨论】:

    标签: android listview autoscroll


    【解决方案1】:

    http://groups.google.com/group/android-developers/msg/753a317a8a0adf03

    要自动滚动,可以这样使用:listView.smoothScrollToPosition(position);

    private void scrollMyListViewToBottom() {
        myListView.post(new Runnable() {
            @Override
            public void run() {
                // Select the last row so it will scroll into view...
                listView.smoothScrollToPosition(myListAdapter.getCount() - 1);
                // Just add something to scroll to the top ;-)
            }
        });
    }
    

    【讨论】:

    • 这是否允许在用户不触摸屏幕的情况下滚动列表?我的要求是列表在没有任何用户交互的情况下自行滚动谢谢
    • 你能帮我举个小例子吗,我尝试使用上面的 sn-p 但列表立即转到调用最后一个 setselection 的行。它根本不做自动滚动
    • ListView.smoothScrollToPosition(int i)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-13
    • 2016-06-26
    • 2021-05-14
    • 1970-01-01
    相关资源
    最近更新 更多