0
votes

Just started to learn kotlin with anko lib. Created a class for UI and got some problem with relative layout. Need to set below property for textView, but when i do that? its just ruins all UI. Here some pice of code. Whats wrong ?

relativeLayout {
    val image : ImageView = imageView(R.mipmap.ic_launcher).lparams {
        gravity = left
        padding = dip(8)
    }
    val u_name: TextView=textView {
        textSize = 20F
        text = "user name"
    }.lparams { margin = dip(5)
        below(image)
    }
}

enter image description here

screenshot

1
That means there was an error generating the preview. There should be a red exclamation point at the top right of the preview window, which will tell you what went wrong. - TheWanderer

1 Answers

0
votes

Solved a problem by using id's insted of variables