我是 Android 开发的新手,我提供了我的代码片段。我想知道为什么它说other must not be null
other = findViewById(R.id.otherId)
我的活动:
class SplashScreen : AppCompatActivity() {
lateinit var topAnimation:Animation
lateinit var bottomAnimation:Animation
lateinit var logoImage:ImageView
lateinit var bangerText:TextView
override fun onCreate(savedInstanceState: Bundle?) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash_screen)
topAnimation=AnimationUtils.loadAnimation(this,R.anim.top_animation)
bottomAnimation=AnimationUtils.loadAnimation(this,R.anim.bottom_animation)
logoImage=findViewById(R.id.logoImage)
bangerText=findViewById(R.id.bangerTextView)
val other=findViewById<TextView>(R.id.textView5)
logoImage.animation=topAnimation
bangerText.animation=bottomAnimation
other.animation=bottomAnimation
}
}