I'm trying to create new LinearLayout with kotlin inside MainActivity.kt
for (i in 0 until tileArr.size){
var tileLayout: LinearLayout = LinearLayout(this)
tileLayout.marginBottom = 10
}
while it throws error Val cannot be reassigned on line: tileLayout.marginBottom = 10
You cannot modify those properties directly, you need to use
LayoutParams
.