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

前端 未结 4 853
半阙折子戏
半阙折子戏 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 11:03

    A relevant example from the official developer docs (http://developer.android.com/guide/topics/ui/layout/linear.html):

    Equally weighted children

    To create a linear layout in which each child uses the same amount of space on the screen, set the android:layout_height of each view to "0dp" (for a vertical layout) or the android:layout_width of each view to "0dp" (for a horizontal layout). Then set the android:layout_weight of each view to "1".

提交回复
热议问题