1
RecycleView
可以用smoothScrollBy
方法滚动。但是Gridview没有扩展RecycleView
。如何像RecycleView一样滚动GridView
?如何在Android中以编程方式水平滚动GridView?
试用gridView.smoothScrollBy(0, dy);
但它没有任何效果。
RecycleView
可以用smoothScrollBy
方法滚动。但是Gridview没有扩展RecycleView
。如何像RecycleView一样滚动GridView
?如何在Android中以编程方式水平滚动GridView?
试用gridView.smoothScrollBy(0, dy);
但它没有任何效果。
我认为你正在寻找smoothScrollByOffset(int offset)
。
偏移量 - 要从适配器位置偏移以滚动到的量。您也可以使用smoothScrollToPosition(int position)
。
我不知道需要滚动的位置差异,它有时可以是浮点值。 –