简体   繁体   中英

Kotlin-anko Relative Layout params problem

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)
    }
}

在此处输入图片说明

截图

通过使用ID的变量解决问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM