LinearLayout addView doesn't work properly

前端 未结 2 1695
一整个雨季
一整个雨季 2021-01-12 21:17

I\'m having issues with the addView method from LinearLayout. I don\'t know why, but if I add three views only the first one is displayed. Here is the code:

         


        
相关标签:
2条回答
  • 2021-01-12 21:54

    Use the hierarchy viewer to check if there really is only 1 view added, or that you can see only one view. For instance, this line android:layout_below="@id/post_list_item_footer_text" might be troublesome if you repeat it? I don't know the expected behaviour for that...

    0 讨论(0)
  • 2021-01-12 22:05

    you do not declare the LinearLayout orientation... by default is Horizontal, try setting the orientation Vertical

    <LinearLayout
        android:id="@+id/post_list_item_comments"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingLeft="40dip"
        android:layout_below="@id/post_list_item_footer_text"
        android:visibility="gone"/>
    
    0 讨论(0)
提交回复
热议问题