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>
RelativeLayoutignoresweight.weightcan only be used insideLinearLayout- Vladyslav Matviienko