'datas = new ArrayList<>();
for (int i = 0; i < 10; i++) {
ProductListBean productListBean = new ProductListBean();
productListBean.setImageLinks("https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1814034794,2782407570&fm=27&gp=0.jpg");
productListBean.setName("用户名" + i);
productListBean.setPrice("手机" +i + "," + "电脑" +i);
productListBean.setVip_price("入行需谨慎,望各位三思而后行,每到写到这种文章的时候......" + i);
datas.add(productListBean);
}'
---
'package com.erxiang.page.commodity.model;
/**
-
@time 2018/7/6 0006
-
@anthor luqp
-
@Description: 推荐商品列表
*/
public class ProductListBean {private String imageLinks;
private String name;
private String price;
private String vip_price;public String getImageLinks() {
return imageLinks;
}public void setImageLinks(String imageLinks) {
this.imageLinks = imageLinks;
}public String getName() {
return name;
}public void setName(String name) {
this.name = name;
}public String getPrice() {
return price;
}public void setPrice(String price) {
this.price = price;
}public String getVip_price() {
return vip_price;
}public void setVip_price(String vip_price) {
this.vip_price = vip_price;
}@Override
public String toString() {
return "ProductListBean{" +
"imageLinks='" + imageLinks + ''' +
", name='" + name + ''' +
", price='" + price + ''' +
", vip_price='" + vip_price + ''' +
'}';
}
}
'
' mAgentShopAdapter = new AgentShopAdapter(datas);
mRecyclerView.setAdapter(mAgentShopAdapter);'
---
'package com.erxiang.page.myorder.adapter;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.erxiang.R;
import com.erxiang.page.commodity.model.ProductListBean;
import java.util.List;
/**
-
@time 2018/7/11 0011
-
@anthor luqp
-
@Description: 可代理的店铺列表
*/
public class AgentShopAdapter extends BaseQuickAdapter<ProductListBean, BaseViewHolder> {public AgentShopAdapter(@Nullable List<ProductListBean> data) {
super(R.layout.adapter_agent_shop_item, data);
}@Override
protected void convert(BaseViewHolder helper, ProductListBean item) {
Glide.with(mContext).load(item.getImageLinks()).into((ImageView) helper.getView(R.id.imageView));
helper.setText(R.id.tv_name,item.getName());
helper.setText(R.id.tv_category,item.getPrice());
helper.setText(R.id.tv_agent_condition,item.getVip_price());helper.addOnClickListener(R.id.agent_shop_click);
}
}
'
网友评论