只需使用float进行类型转换,如下所示:(float)Math.sqrt(...) FloatMath 在 API 22 中已被弃用。 参考链接 - https://developer.android.com/reference/android/util/FloatMath.html