Kotlin 未解决的参考:btn_start 但我在我的布局中定义了它
Kotlin Unresolved reference: btn_start but i define it in my layout
这是我在 activity_main.xml
中的代码
<Button
android:id="@+id/btn_start"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@color/white"
android:text="Start"
android:textColor="#757575"
android:textSize="18sp">
</Button>
但是当我编码时
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
btn_start
它会给我错误提示未解决的引用 (btn_start)
Kotlin Android Extensions is deprecated, which means that using Kotlin
synthetics for view binding is no longer supported.
请参考官方文档here
这是我在 activity_main.xml
中的代码<Button
android:id="@+id/btn_start"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@color/white"
android:text="Start"
android:textColor="#757575"
android:textSize="18sp">
</Button>
但是当我编码时
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
btn_start
它会给我错误提示未解决的引用 (btn_start)
Kotlin Android Extensions is deprecated, which means that using Kotlin synthetics for view binding is no longer supported.
请参考官方文档here