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?
}
}
});
}