String money = data.getSum();
float scale = Float.valueOf(money);
DecimalFormat fnum = new DecimalFormat("##0.00");
String dd = fnum.format(scale);
holder.qian.setText(dd + " 元");
这样就直接可以做到,string转成float,并且保留两位小数啦
String money = data.getSum();
float scale = Float.valueOf(money);
DecimalFormat fnum = new DecimalFormat("##0.00");
String dd = fnum.format(scale);
holder.qian.setText(dd + " 元");
这样就直接可以做到,string转成float,并且保留两位小数啦