RecyclerView中item嵌套RecyclerView不显示问题

在嵌套时要给嵌套的RecyclerView设置宽高,否则不显示



/**
 * 重设item的高度
 */
private void resetRecyclerHeight(int type, int size) {
    ViewGroup.LayoutParams layoutParams = item_recyclerview.getLayoutParams();
    layoutParams.width = RecyclerView.LayoutParams.MATCH_PARENT;
    if (type == 1) {
        int coverWidth = (GlobleData.screenWidth - Uitl.dip2px(getContext(), 78)) / 4;
        //单个图片高
        int coverHeight = coverWidth * 9 / 16;
        layoutParams.height = coverHeight * size;
    } else {
        layoutParams.height = ((GlobleData.screenWidth - Uitl.dip2px(getContext(), 100)) / 6) * size;
    }


    item_recyclerview.setLayoutParams(layoutParams);
}

你可能感兴趣的:(RecyclerView中item嵌套RecyclerView不显示问题)