我试过了,
recyclerview.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,100));
但它不起作用.
尝试设置这样的高度,
ViewGroup.LayoutParams params=recyclerview.getLayoutParams(); params.height=100; recyclerview.setLayoutParams(params);