1

I think the title is enough explicit however let's explain it again.

I have a RelativeLayout and a GridView that I've set weights at 1/3 for the first one and 2/3 for the second, but on some screens the RelativatLayout isn't wide enough, so my question, How can I do to make sure my RelativeLayout has enough place ?

Thanks.

Ektos974
  • 999
  • 10
  • 30
  • 1
    You should post your xml and possibly a picture of what you have/want. Neither of those `ViewGroups` have a `weight` attribute. – codeMagic Apr 14 '14 at 13:41

3 Answers3

0

Wrap your RelativeLayout inside linearLayout that will allow you can use weights then

user3455363
  • 408
  • 1
  • 5
  • 13
0

Only a LinearLayout can be used as a parent to use weights. You should have a Layout Structure having a LinearLayout as the parent, having widh=fillparent and weightsum=3 and orientation=horizontal. Then have Your GridView and RelativeLayout be the children of parent LinearLayout. Set Children's width=0dp and weight =1 and 2 respectively. Doing this should do the needful.

Parth Kapoor
  • 1,494
  • 12
  • 23
  • I think you misunderstand what I was trying to say. My RelativeLayout and my GridView are into a LinearLayout I know there's only the linearlayout which supports weight. Thanks anyway to take time :) – Ektos974 Apr 14 '14 at 13:50
0

I've change the proportions, here my new configuration: 3/6 RL and 4/6 GV

If anyone found a better to keep the 1/3-2/3 ratio with a minimum width for the first one, he/she can contact me :)

Ektos974
  • 999
  • 10
  • 30