Why does a RecyclerView.LayoutManager's default smoothScrollToPosition method Log.e()?

守給你的承諾、 提交于 2019-12-12 03:04:10

问题


I'm suprised by Android code sometimes. As the title asks;

Why does a RecyclerView.LayoutManager's default smoothScrollToPosition method write a Log.e message instead of throwing an exception?

(This is in the support v7 library, 24.0.0)

public void smoothScrollToPosition(RecyclerView recyclerView, State state, int position) {
        Log.e(TAG, "You must override smoothScrollToPosition to support smooth scrolling");
    }

I would expect this method to throw an exception since whoever called this method obviously didn't implement the required methods/classes.

来源:https://stackoverflow.com/questions/38391869/why-does-a-recyclerview-layoutmanagers-default-smoothscrolltoposition-method-lo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!