以下是编译错误
None of the following functions can be called with the arguments supplied:
public final operator fun div(other: Byte): Int defined in kotlin.Int
public final operator fun div(other: Double): Double defined in kotlin.Int
public final operator fun div(other: Float): Float defined in kotlin.Int
public final operator fun div(other: Int): Int defined in kotlin.Int
public final operator fun div(other: Long): Long defined in kotlin.Int
public final operator fun div(other: Short): Int defined in kotlin.Int我在我的活动中尝试了倒计时计时器,下面是我的代码。我得到了除法运算符上的错误标记
mTimerTextview.setText(millisUntilFinished.toInt() / 1000.toString() + "s")完整代码
startQuizButton.setOnClickListener {
constraintChild.visibility = View.VISIBLE
startQuizButton.visibility = View.GONE
score = 0
totalAttempt = 0
mStatusTextview.text = "0/0"
newQuestion()
countDownTimer = object : CountDownTimer(30100, 1000) {
override fun onTick(millisUntilFinished: Long) {
mTimerTextview.setText(millisUntilFinished.toInt() / 1000.toString() + "s")
}发布于 2021-05-28 00:47:10
我只需替换这个:
val one = millisUntilFinished.toInt()
val two = 1000
mTimerTextview.text = ((one / two).toString() + "s")https://stackoverflow.com/questions/67683460
复制相似问题