/** * 获取RecyclerView的对于View * @param recyclerView * @param position * @return */ public View getRecyclerViewItem(RecyclerView recyclerView,int position){ if (recyclerView == null || recyclerView.getLayoutManager() == null || recyclerView.getAdapter() == null||recyclerView.getAdapter().getItemCount()<=0){ return null; } if (position > recyclerView.getAdapter().getItemCount()){ return null; } RecyclerView.ViewHolder viewHolder = recyclerView.getAdapter().createViewHolder(recyclerView,recyclerView.getAdapter().getItemViewType(position)); recyclerView.getAdapter().onBindViewHolder(viewHolder,position); viewHolder.itemView.measure(View.MeasureSpec.makeMeasureSpec(recyclerView.getWidth(),View.MeasureSpec.EXACTLY),View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED)); return viewHolder.itemView; }
RecycleView获取实际位置View
最新推荐文章于 2024-06-24 14:23:29 发布
关键词由CSDN通过智能技术生成