Android Listview 遇到 smoothScrollToPosition()方法失效,或者滑动位置不准
项目中遇到的问题:
private void updateListViewScrollPosition() {
int position = searchedListViewAdapter.getPlayingPosition();
if (position != -1) {
Log.d(TAG, "scroll to position:" + position);
presetListView.smoothScrollToPosition(position);
}
}
解决方案:
请尝试修改布局文件中的divider大小
android:dividerHeight="15dp"
本文介绍了解决Android开发中ListView使用smoothScrollToPosition()方法出现定位不准或失效问题的方法。通过调整布局文件中的divider高度,可以有效解决滑动定位不准确的问题。

5146

被折叠的 条评论
为什么被折叠?



