我使用下面的代码的String.format()不是的EditText在Android平台
Tx1XKBytes = (Tx1XBytes.doubleValue()/1024.0); //Tx1XKBytes is long variable
BytesSent1X.setText(String.format("%.2f", Tx1XKBytes) +" KB"); //BytesSent1X is EdiText
我想要的变量Tx1XKBytes有精密最多两个小数点像23.46,但它无法正常工作。结果显示整个值如23.467658。
龙变量没有小数部分 - 这是否意味着Tx1XKBytes实际上是一个'double'? – ianhanniballake