kHRYSTAL / CircleRecyclerView

the library is a loop RecyclerView(expression), can show some effects when display
714 stars 100 forks source link

怎样获得选中的值? #12

Closed xufucun closed 7 years ago

xufucun commented 7 years ago

怎样获得选中的值?

kHRYSTAL commented 7 years ago

in smoothScrollToView add callback, the arguments is the selected

gagan50 commented 6 years ago

Ok I'll check tomorrow and give feedback on same. Thank you

gagan50 commented 6 years ago

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