TurnLayoutManager.java 文件源码

java
阅读 38 收藏 0 点赞 0 评论 0

项目:RLibrary 作者:
/**
 * Set bumper offsets on child views for {@link Orientation#HORIZONTAL}
 */
private void setChildOffsetsHorizontal(@Gravity int gravity,
                                       @Dimension int radius,
                                       Point center,
                                       int peekDistance) {
    for (int i = 0; i < getChildCount(); i++) {
        View child = getChildAt(i);
        RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) child.getLayoutParams();
        final int yOffset = (int) resolveOffsetY(radius, child.getX() + child.getWidth() / 2, center, peekDistance);
        final int y = gravity == Gravity.START ? yOffset + layoutParams.getMarginStart()
                : getHeight() - yOffset - child.getHeight() - layoutParams.getMarginStart();

        child.layout(child.getLeft(), y, child.getRight(), child.getHeight() + y);
        setChildRotationHorizontal(gravity, child, radius, center);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号