RecyclerView中item嵌套RecyclerView不显示问题

来源:互联网 发布:淘宝上卖什么的最少 编辑:程序博客网 时间:2024/05/23 11:47

在嵌套时要给嵌套的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);}

阅读全文
0 0
原创粉丝点击