我在这部影片之后,但我的程式码无法运作

时间:2019-09-20 15:11:25

标签: android kotlin

https://www.youtube.com/watch?v=EOfCEhWq8sg&t=294s

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    val rollButton = findViewById<Button>(R.id.rollButton)
    val resultsText = findViewById<TextView>(R.id.resultText)
    val seekBar = findViewById<SeekBar>(R.id.seekBar)

    rollButton.setOnClickListener{
        val rand = Random().nextInt(seekBar.progress) //bondInt
        resultsText.text = rand.toString()
    }}}

1 个答案:

答案 0 :(得分:0)

从视频中看,您的R.id.resultText应该是R.id.resultsTextView