Before 2022/Android
Kotlin으로 Custom View 만들기
Eljoe
2020. 8. 25. 14:11
class InitView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : LinearLayout(context, attrs, defStyleAttr){
init {
val inflater: LayoutInflater = getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
val view = inflater.inflate(R.layout.view_main, this, false)
addView(view)
// 로직
}
}