Kotlin Android Extensions: How to get a reference to a view in a layout that gets included into another layout?
You should import
the included layout.
import android.app.Activity
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.included_layout.* // Here
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// From activity_main.textView
textView.text = "text"
// From included_layout.textViewInclude
textViewInclude.text = "textInclude"
}
}