Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 Andorid 中创建一个自下而上的链接按钮。我有一个包含大量数据的 ListView。
例如看看这个网站。想象一下,您向下滚动到网页底部,并且想要回到网页顶部。为此,您可以单击将页面滚动回文档开头的返回顶部按钮。
以同样的方式,我希望我在 Android 中的 ListView 使用它。我在 Google 中搜索过,但没有找到与此相关的任何内容。请你帮助我好吗?
有几种方法可以滚动到列表顶部
listView.setSelectionAfterHeaderView(); listView.smoothScrollToPosition(0); listview.setSelection(0);
myFAB.setOnClickListener(new OnClickListener() { public void onClick(View v) { myScrollView.scrollTo(0, 0); } });