问题
I am building a calculator but when you start with decimals it won't round to the nearest tenth like I want it to. Anyone's help would be greatly appreciated. https://fuzzyandroidblog.wordpress.com/ I added it here wouldn't let me post for some reason thanks for help
回答1:
Use a NumberFormat with maximum fraction digits of 1 to format a floating point value to a string representation with at most one number after the decimal point.
来源:https://stackoverflow.com/questions/27422365/how-to-make-calculator-round-to-nearest-tenth