Android: Kotlin with Butterknife

前端 未结 10 1000
鱼传尺愫
鱼传尺愫 2020-12-24 04:55

I\'m trying to use Kotlin with Butterknife for my Android Application.

Here is my build.gradle

dependencies {
    ...
    compile \'com.jakewharton:b         


        
10条回答
  •  轮回少年
    2020-12-24 05:37

    Jake Wharton created new library for kotlin called kotterknife: https://github.com/JakeWharton/kotterknife Gradle:

    compile 'com.jakewharton:kotterknife:0.1.0-SNAPSHOT'
    

    View:

    val lastName: TextView by bindView(R.id.last_name)
    
      // Optional binding.
      val details: TextView? by bindOptionalView(R.id.details)
    
      // List binding.
      val nameViews: List by bindViews(R.id.first_name, R.id.last_name)
    
      // List binding with optional items being omitted.
      val nameViews: List by bindOptionalViews(R.id.first_name, R.id.middle_name, R.id.last_name)
    

提交回复
热议问题