我是靠谱客的博主 坚定项链,这篇文章主要介绍List集合 值进行累加,现在分享给大家,希望可以做个参考。


//转换小数点
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集合内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(121)

评论列表共有 0 条评论

立即
投稿
返回
顶部