Android
๋ทฐ๋ฐ์ธ๋ฉ ์ด๊ธฐ ์์
๋
ธ๋ฃจ๋ฃฝ
2021. 2. 26. 22:44
1. build.gradle(Module:ํ๋ก์ ํธ์ด๋ฆ.app)์ android ๋ฐ์ ์ด ์ฝ๋๋ฅผ ์ถ๊ฐ
buildFeatures {
viewBinding = true
}
2. MainActivity.kt๋ก ๊ฐ์ ์ฝ๋ ์ถ๊ฐ
class MainActivity : AppCompatActivity() {
lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
}
}