Home > Mobile >  Android linear layout or relative layout layout problem
Android linear layout or relative layout layout problem

Time:11-06

In a linear layout, for example, the width of the linear layout for match_parent, it has two child View, the width of the View are uncertain, the second View behind the first View, if the width of the first View is too high, will be the second layout out, so what are the ways or way to ensure the normal display of the second View?

CodePudding user response:

Use the maxWidth, set the maximum width

CodePudding user response:

Can set layout_weigth ah

CodePudding user response:

 
Android: layout_width="match_parent"
Android: layout_height="wrap_content" & gt;
Android: text="text"
Android: layout_width="0 dp"
Android: layout_height="wrap_content"
Android: layout_weight="1"/& gt;
Android: text="text"
Android: layout_width="wrap_content"
Android: layout_height="wrap_content"/& gt;

CodePudding user response:

Set up the first TextView weight layout_weight="1", the width of the layout_width="0 dp", you can put the weights as a relative percentage, father takes up the percentage of residual control layout, if you want two TextView, each accounted for 50% of the parent layout, the weight of the second TextView layout_weight="1", the width of the layout_width="0 dp", can, you will be more,
  • Related