Why do ListView items not grow to wrap their content?

前端 未结 9 699
猫巷女王i
猫巷女王i 2020-11-30 20:26

I have a rather complex ListView, with variable list item heights. Under certain conditions, I need to display an additional view in a list item, which is hidden by default

9条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-30 20:44

    Things to note about column alignment:

    • The container LinearLayout element uses horizontal orientation and android:layout_width as match_parent.
    • The TextView elements use android:layout_width="0dp"
    • Each of the two TextView elements uses android:layout_weight="1" so that they use equal amounts of the available width.
    • The android:layout_width property of each TextView element is set to "0dp".

提交回复
热议问题