@NonNull @Override public MyHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View view = layoutInflater.inflate(R.layout.video_list_layout,viewGroup,false); MyHolder myHolder = new MyHolder(view); int parentHeight= viewGroup.getHeight(); viewGroup.getWidth(); ViewGroup.LayoutParams layoutParams = myHolder.itemView.getLayoutParams(); layoutParams.height = (parentHeight/ 3);//显示三条 return myHolder; }
RecyclerView 在布局中显示指定的item数目
最新推荐文章于 2022-01-01 19:01:29 发布