首页 > 移动平台 > 详细

android TextView自动显示成科学计算法

时间:2018-08-19 16:08:17      阅读:255      评论:0      收藏:0      [点我收藏+]

就例如:

        TextView textView1 = (TextView) findViewById(R.id.TextView1);
        double test = 99999999999.99;
        textView1.setText(String.valueOf(test));

会显示成9.999999999E10

解决办法

修改成:

        double test = 99999999999.99;
        TextView textView2 = (TextView) findViewById(R.id.TextView2);
        textView2.setText(String.format(Locale.ENGLISH, "%.3f", test));

会显示99999999999.990

android TextView自动显示成科学计算法

原文:https://www.cnblogs.com/momoshengxiao/p/9501461.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!