https://kotlinlang.org logo
p

punksta

01/28/2017, 4:50 PM
hey! I have a problem with anko. trying to fill linearLayout using anko extention methods. But linearLayout is empty after this method .
Copy code
`
 fun showList(list: List<Link>) = with(legal_docs) {
        list.forEach { link ->
            textView {
                layoutParams = LinearLayout.LayoutParams(matchParent, wrapContent)
                text = link.name
                setPadding(dimen(R.dimen.activity_horizontal_margin), dip(8), dimen(R.dimen.activity_horizontal_margin), dip(8))
                FontUtil.setFont(this, R.string.font_avenir)
                textSize = 16f
                onClick {
                    openLink(link)
                }
            }
            view {
                setBackgroundResource(R.color.deliver_black)
                layoutParams = LinearLayout.LayoutParams(matchParent, dip(0.5f))
            }
        }
    }
layout:
Copy code
<ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:orientation="vertical"
            android:id="@+id/legal_docs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

    </ScrollView>