//转换小数点
DecimalFormat
xsTwo = new DecimalFormat("0.00");
//首先把值置为0
private Double shipping_fee = 0.0;
//循环进行累加
for (int i = 0; i < store_cart_list.size(); i++) {
shipping_fee = shipping_fee +store_cart_list.get(i).shipping_fee;
Log.i("sum_num", "onHandleSuccess: "+shipping_fee);
//邮费
if (shipping_fee == 0.0) {
mYfPrice.setText("¥ "+xsTwo.format(shipping_fee));//赋值
} else {
mYfPrice.setText("¥ " + xsTwo.format(shipping_fee) + "");//赋值
}
}
最后
以上就是坚定项链最近收集整理的关于List集合 值进行累加的全部内容,更多相关List集合内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复