@Override
public void onBindViewHolder(viewHolder holder, int position) {
HomeModel m=arrayList.get(position);
holder.imageView.setImageResource(m.getPhoto_id());
holder.textView.setText(m.getName());
if(position==0)
holder.cardView.setBackgroundColor(Color.rgb(255,205,210));
else if(position==1)
holder.cardView.setBackgroundColor(Color.rgb(157,255,164));
else if(position==2)
holder.cardView.setBackgroundColor(Color.rgb(209,196,233));
else if(position==3)
holder.cardView.setBackgroundColor(Color.rgb(187,222,251));
else if(position==4)
holder.cardView.setBackgroundColor(Color.rgb(255,204,128));
else if(position==5)
holder.cardView.setBackgroundColor(Color.rgb(255,245,157));
else if(position==6)
holder.cardView.setBackgroundColor(Color.rgb(248,187,208));
else if(position==7)
holder.cardView.setBackgroundColor(Color.rgb(198,193,250));
}
HomeAdapter.java 文件源码
java
阅读 42
收藏 0
点赞 0
评论 0
项目:Hillffair17
作者:
评论列表
文章目录