getScrollX()返回错误的值,为什么?

时间:2016-08-01 20:28:26

标签: java android

recList.getScrollX()行总是返回0,即使用户已经滚动了recList

protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            final RecyclerView recList = (RecyclerView) findViewById(R.id.userSettingList);

    horizontalScrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {

                @Override
                public void onScrollChanged() {

                        int scrollX0 = recList.getScrollX(); //always returns 0, why?

                    }
                }
            });
        }

0 个答案:

没有答案