首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Kotlin错误:无法使用提供的参数调用以下任何函数

Kotlin错误:无法使用提供的参数调用以下任何函数
EN

Stack Overflow用户
提问于 2021-05-25 15:24:50
回答 1查看 59关注 0票数 0

以下是编译错误

代码语言:javascript
复制
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

我在我的活动中尝试了倒计时计时器,下面是我的代码。我得到了除法运算符上的错误标记

代码语言:javascript
复制
mTimerTextview.setText(millisUntilFinished.toInt()  / 1000.toString() + "s")

完整代码

代码语言:javascript
复制
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")
                }
EN

回答 1

Stack Overflow用户

发布于 2021-05-28 00:47:10

我只需替换这个:

代码语言:javascript
复制
val one = millisUntilFinished.toInt()
                    val two = 1000
                    mTimerTextview.text = ((one / two).toString() + "s")
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67683460

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档