In android layouts what is the effect/meaning of layout_height=“0dip”

前端 未结 4 858
半阙折子戏
半阙折子戏 2020-12-01 10:01

I\'ve seen several examples that use android:layout_height=\"0px\" or \"0dip\" but i do not understand the impact of this. It seems that would make the layout 0 pixels tall.

4条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-01 10:54

    When we have to assign equal weight to the different view in LINEAR LAYOUT then we assign either layout/width = 0dp(for horizontal orientation) or layout/height = 0dp(for vertical orientation) and set View /weight ==1 for every view inside that Linear Layout.

    Advantage:::: -- on assigning width or height to 0dp then it have no impact and due to weight==1 all the view occupies same space and covered the whole screen size.

提交回复
热议问题