-1

I just Created a Relative Layout with id rl1 What I need I want to create a weightSum with 2 for this relative layout as to put in this layout another 2 relative layout one with id fireID and the other relative layout cartID which each of them take a weight 1 how can I silve this issue this is my xml file

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    tools:context="abtech.waiteriano.com.waitrer.MenuActivity">
    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/colorPrimary"
        android:minHeight="?attr/actionBarSize" />
    <!--   <FrameLayout
       android:id="@+id/content_frame"
       android:layout_width="matc
        h_parent"
       android:layout_height="wrap_content"></FrameLayout>-->
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="bottom"
        android:id="@+id/rl1"
        android:orientation="horizontal"
        android:weightSum="2">
        <FrameLayout
            android:id="@+id/content_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_above="@+id/fireID">
        </FrameLayout>

        <RelativeLayout
            android:id="@+id/fireID"
            android:layout_width="fill_parent"
            android:layout_height="50dp"
            android:layout_weight="1"
            android:background="#ff6b6b"
            android:layout_alignParentBottom="true"
            android:layout_alignParentStart="true">
            <ImageView
                android:id="@+id/imageView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                android:layout_gravity="center"
                android:src="@drawable/fire" />
        </RelativeLayout>
        <RelativeLayout
            android:id="@+id/cartID"
            android:layout_width="fill_parent"
            android:layout_height="50dp"
            android:layout_weight="1"
            android:background="#ff6b6b"
            android:layout_alignParentBottom="true"
            android:layout_alignParentStart="true">
            <ImageView
                android:id="@+id/imageCart"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                android:layout_gravity="center"
                android:src="@drawable/shoppingcart" />
        </RelativeLayout>
    </RelativeLayout>
</LinearLayout>
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

1 Answers1

3

We can't use Weight in RelativeLayout.

Asif Patel
  • 1,744
  • 1
  • 20
  • 27
  • I actually know that but When I change this to linear layout it change the whole view as I need this linear layout shows at the bottom of the page which contains layouts @Asif Patel –  Mar 06 '17 at 13:13
  • Remove RelativeLayout of id fireId and cartId and create LinearLayout with alignParentBottom attribute and put your 2 ImageView's in it. with each ImageView has weight 1. – Asif Patel Mar 06 '17 at 13:19