【发布时间】:2017-09-19 22:07:32
【问题描述】:
我有一个包含一些视图的布局,其中一个的 ID 为 title_whalemare
import kotlinx.android.synthetic.main.controller_settings.*
import kotlinx.android.synthetic.main.view_double_text.*
class MainSettingsController : BaseMvpController<MvpView, MvpPresenter>() {
val title: TextView = title_whalemare
override fun getLayout(): Int {
return R.layout.controller_settings
}
}
我尝试使用kotlin extensions 找到它,但我不能,因为我收到以下错误
controller_settings.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/title_whalemare"/>
</LinearLayout>
我的错误在哪里?
【问题讨论】:
标签: android kotlin kotlin-android-extensions kotlin-extension