Closed xufucun closed 7 years ago
in smoothScrollToView
add callback, the arguments is the selected
Ok I'll check tomorrow and give feedback on same. Thank you
the method is below please elobrate where i have to code.
public void smoothScrollToView(View v) { int distance = 0; if (getLayoutManager() instanceof LinearLayoutManager) { if (getLayoutManager().canScrollVertically()) { final float y = v.getY() + v.getHeight() 0.5f; final float halfHeight = getHeight() 0.5f; distance = (int) (y - halfHeight); } else if (getLayoutManager().canScrollHorizontally()) { final float x = v.getX() + v.getWidth() 0.5f; final float halfWidth = getWidth() 0.5f; distance = (int) (x - halfWidth); }
} else
throw new IllegalArgumentException("CircleRecyclerView just support T extend LinearLayoutManager!");
smoothScrollBy(distance,distance);
}
怎样获得选中的值?