방금 id가 ll1 인 상대 레이아웃을 만들었습니다.이 체중을 2로 만들려고합니다.이 레이아웃에 배치하는 상대 레이아웃은 다른 2 개의 상대적 레이아웃 중 하나이며, id는 fireID이고 다른 하나는 다른 것입니다. 그들 각각의 가중치 1을 상대 레이아웃 cartID는 어떻게이 내 XML이RelativeLayout에서 weightSum을 사용하는 방법
이<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>
하면이 ... http://stackoverflow.com/questions/21144691/alternative-to-weightsum-in-relativelayout –
를 참조하십시오 이 속성은 LinearLayout에서만 사용합니다 –
첫 번째'RelativeLayout'을'LinearLayout'으로 바꿉니다 –