enter image description here Hello! I have 12 sections, height (4 columns), I placed my blocks using the weight attribute, now I need my one block to occupy 1/3 of the layout width, tell me how best to implement?

here is xml:

<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView3" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:src="@drawable/avto" /> </RelativeLayout> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView4" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:src="@drawable/avto" /> </RelativeLayout> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView5" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:src="@drawable/avto" /> </RelativeLayout> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> </RelativeLayout> 

  • show xml. "on the photo" I do not guess. - Vladyslav Matviienko September
  • added please see - OPTIMIST .KZ
  • RelativeLayout ignores weight . weight can only be used inside LinearLayout - Vladyslav Matviienko
  • How can I divide the width into 3 parts inside RelativeLayout? - OPTIMIST .KZ
  • one
    No, for the width you need to put the elements in LinearLayout, and ask them the weight of 1 - Vladyslav Matviienko

0