Linear Layout and weight in Android

后端 未结 18 2770
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 02:41

I always read about this funny weight value in the Android documentations. Now I want to try it for the first time but it isn\'t working at all.

As I understand it

18条回答
  •  独厮守ぢ
    2020-11-22 02:44

    Like answer of @Manoj Seelan

    Replace android:layout_weight With android:weight.

    When you use Weight with LinearLayout. you must add weightSum in LinearLayout and according to orientation of your LinearLayout you must setting 0dp for Width/Height to all LinearLayout`s Children views

    Example :

    If The orientation of Linearlayout is Vertical , then Set Width of all LinearLayout`s Children views with 0dp

     
    
         

    If the orientation Linearlayout of is horizontal , then Set Height of all LinearLayout`s Children views with 0dp.

     
    
         

提交回复
热议问题