Home > Software engineering >  3 layout in one activity
3 layout in one activity

Time:10-03

I would like to have multiple layout in my activity in would go in this order

<Linear layout
android:orientation="vertical" android:layout_width="match_parent">

      <Constraint layout>

      <\Constraint layout>

      <Relative Layout>

      <\Relative Layout>

      <Constraint Layout>

      <\Constraint Layout>

<Linear layout\>

I would like for each of them to take one third of the height which is why I've chosen the Vertical linear layout P.S. I know each layout contains more stuff in them however I don't think we need them to understand the problem

CodePudding user response:

so what's the problem, just do that.
if you're asking about how to make them take 1/3, set the layout_weight attribute to 0.34, layout_height to 0dp in each of them and linear_layout will do the rest.

P.S : two of them will have layout_weight = 0.34, the third should be 1-0.34*2 which is 0.32, or maybe one 0.34 two 0.33, you specify the weights as you like.

  • Related