private List<ShopBean> list=new ArrayList<>();
ShopBean bean=null;
private LinearLayout addLinear;
for(int i=0;i<5;i++){
list.add(new ShopBean("201611102","1000"))
}
for(int i=0;i<list.size();i++){
bean=list.get(i);
View view=LayoutInflater.from(this).inflater(R.layout.activity_linear_item,null);
TextView shopName=(TextView)view.findViewById(R.id.shopName);
TextView shopAccount=(TextView)view.findViewById(R.id.shopAccount);
//设置部分字体颜色
String result="<font color='#ff5245'>¥"+bean.getShopAccount()+"</font>";
shopName.setText(bean.getShopName());
shopAccount.setText(Html.fromHtml(result));
addLinear.addView(view);
}
动态增加自定义布局
最新推荐文章于 2022-10-25 00:43:14 发布