GridRecyclerView.java 文件源码

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

项目:narrate-android 作者:
@Override
protected void attachLayoutAnimationParameters(View child, ViewGroup.LayoutParams params, int index, int count) {

    if (getAdapter() != null && getLayoutManager() instanceof GridLayoutManager){

        GridLayoutAnimationController.AnimationParameters animationParams =
                (GridLayoutAnimationController.AnimationParameters) params.layoutAnimationParameters;

        if (animationParams == null) {
            animationParams = new GridLayoutAnimationController.AnimationParameters();
            params.layoutAnimationParameters = animationParams;
        }

        int columns = ((GridLayoutManager) getLayoutManager()).getSpanCount();

        animationParams.count = count;
        animationParams.index = index;
        animationParams.columnsCount = columns;
        animationParams.rowsCount = count / columns;

        final int invertedIndex = count - 1 - index;
        animationParams.column = columns - 1 - (invertedIndex % columns);
        animationParams.row = animationParams.rowsCount - 1 - invertedIndex / columns;

    } else {
        super.attachLayoutAnimationParameters(child, params, index, count);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号