title: Using layout_weight for ImageView in RelativeLayout
body: <p>I'm using a RelativeLayout with an ImageView on the left. Here I hardcoded the layout_width for it with 150dp but this doesn't look good on other screens. On bigger screens the 150dp is fairly little. So I thought about using layout_weight but I can't use this on RelativeLayout.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res    
  /android"
              xmlns:app="http://schemas.android.com/apk/res-auto"
              android:id="@+id/layout_quiz"
              android:layout_width="match_parent"
              android:layout_height="match_parent"&gt;
  
  &lt;android.support.v7.widget.Toolbar
      android:id="@+id/toolbar"
      android:layout_width="match_parent"
      android:layout_height="?attr/actionBarSize"
      android:background="?attr/colorPrimary"
      android:fitsSystemWindows="true"
      android:minHeight="?attr/actionBarSize"
      android:padding="2dp"
      app:titleMarginStart="20dp"
      app:titleTextAppearance="@style/MyMaterialTheme.Base.TitleTextStyle"
      app:titleTextColor="@color/textColorPrimary"&gt;
  
      &lt;TextView
          android:id="@+id/toolbar_title"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:textColor="@android:color/white"
          android:textStyle="bold|italic"/&gt;
  
  &lt;/android.support.v7.widget.Toolbar&gt;
  
  &lt;TextView
      android:id="@+id/tv_topic"
      android:layout_width="150dp"
      android:layout_height="wrap_content"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:layout_below="@+id/toolbar"
      android:background="@android:color/holo_green_light"
      android:gravity="center"
      android:padding="5dp"
      android:textColor="@android:color/white"/&gt;
  
  &lt;RelativeLayout
      android:id="@+id/layout_question"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_below="@+id/toolbar"
      android:layout_toEndOf="@+id/tv_topic"
      android:layout_toRightOf="@+id/tv_topic"
      android:gravity="top"
      android:orientation="horizontal"&gt;
  
      &lt;TextView
          android:id="@+id/tv_question"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentTop="true"
          android:layout_toLeftOf="@+id/bt_favorite"
          android:padding="5dp"
          android:text="Schritte der Trainingssteuerung. Was ist hier richtige Reihenfolge?"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:textStyle="bold"/&gt;
  
      &lt;ImageButton
          android:id="@+id/bt_favorite"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentRight="true"
          android:background="#00ffffff"
          android:src="@drawable/star"/&gt;
  &lt;/RelativeLayout&gt;
  
  &lt;View
      android:layout_width="fill_parent"
      android:layout_height="1dp"
      android:layout_alignBottom="@+id/layout_question"
      android:layout_toEndOf="@+id/tv_topic"
      android:layout_toRightOf="@+id/tv_topic"
      android:background="?android:attr/listDivider"/&gt;
  
  &lt;View
      android:id="@+id/view"
      android:layout_width="1dp"
      android:layout_height="fill_parent"
      android:layout_below="@+id/toolbar"
      android:layout_toEndOf="@+id/iv_image"
      android:layout_toRightOf="@+id/iv_image"  
      android:background="?android:attr/listDivider"/&gt;
  
  &lt;LinearLayout
      android:id="@+id/layout_multiplechoice"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_below="@+id/layout_question"
      android:layout_margin="5dp"
      android:layout_toEndOf="@+id/iv_image"
      android:layout_toRightOf="@+id/iv_image"
      android:orientation="horizontal"&gt;
  
      &lt;LinearLayout
          android:id="@+id/layout_multiplechoice_solutions"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_gravity="center_vertical"
          android:orientation="vertical"
          android:visibility="invisible"&gt;
  
          &lt;CheckBox
              android:id="@+id/cb_solution1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:enabled="false"/&gt;
  
          &lt;CheckBox
              android:id="@+id/cb_solution2"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:enabled="false"/&gt;
  
          &lt;CheckBox
              android:id="@+id/cb_solution3"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:enabled="false"/&gt;
  
          &lt;CheckBox
              android:id="@+id/cb_solution4"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:enabled="false"/&gt;
  
          &lt;CheckBox
              android:id="@+id/cb_solution5"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:enabled="false"/&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:id="@+id/layout_multiplechoice_answers"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_gravity="center_vertical"
          android:orientation="vertical"&gt;
  
          &lt;CheckBox
              android:id="@+id/cb_answer1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:buttonTint="@android:color/holo_green_light"/&gt;
  
          &lt;CheckBox
              android:id="@+id/cb_answer2"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:buttonTint="@android:color/holo_green_light"/&gt;
  
          &lt;CheckBox
              android:id="@+id/cb_answer3"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:buttonTint="@android:color/holo_green_light"/&gt;
  
          &lt;CheckBox
              android:id="@+id/cb_answer4"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:buttonTint="@android:color/holo_green_light"/&gt;
  
          &lt;CheckBox
              android:id="@+id/cb_answer5"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:buttonTint="@android:color/holo_green_light"/&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:id="@+id/layout_singlechoice"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_below="@+id/layout_question"
      android:layout_margin="5dp"
      android:layout_toEndOf="@+id/iv_image"
      android:layout_toRightOf="@+id/iv_image"
      android:orientation="horizontal"
      android:visibility="gone"&gt;
  
      &lt;LinearLayout
          android:id="@+id/layout_singlechoice_solutions"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_gravity="center_vertical"
          android:orientation="vertical"
          android:visibility="invisible"&gt;
  
          &lt;RadioGroup
              android:id="@+id/rg_solution_group"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"&gt;
              &lt;RadioButton
                  android:id="@+id/rb_solution1"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:enabled="false"/&gt;
  
              &lt;RadioButton
                  android:id="@+id/rb_solution2"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:enabled="false"/&gt;
  
              &lt;RadioButton
                  android:id="@+id/rb_solution3"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:enabled="false"/&gt;
  
              &lt;RadioButton
                  android:id="@+id/rb_solution4"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:enabled="false"/&gt;
  
              &lt;RadioButton
                  android:id="@+id/rb_solution5"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:enabled="false"/&gt;
          &lt;/RadioGroup&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:id="@+id/layout_singlechoice_answers"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_gravity="center_vertical"
          android:orientation="vertical"&gt;
  
          &lt;RadioGroup
              android:id="@+id/rg_answer_group"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"&gt;
  
              &lt;RadioButton
                  android:id="@+id/rb_answer1"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"/&gt;
  
              &lt;RadioButton
                  android:id="@+id/rb_answer2"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"/&gt;
  
              &lt;RadioButton
                  android:id="@+id/rb_answer3"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"/&gt;
  
              &lt;RadioButton
                  android:id="@+id/rb_answer4"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"/&gt;
  
              &lt;RadioButton
                  android:id="@+id/rb_answer5"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"/&gt;
          &lt;/RadioGroup&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  
  
  &lt;LinearLayout
      android:id="@+id/layout_info"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_above="@+id/layout_progressbar"
      android:layout_below="@+id/layout_question"
      android:layout_toEndOf="@+id/iv_image"
      android:layout_toRightOf="@+id/iv_image"
      android:orientation="vertical"&gt;
  
      &lt;TextView
          android:id="@+id/tv_infotitle"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_margin="7dp"
          android:textStyle="bold"/&gt;
  
      &lt;ScrollView android:id="@+id/sv_infoscroller"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:fillViewport="true"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"
          &gt;
  
  
              &lt;TextView
                  android:id="@+id/tv_infotext"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/tv_infotitle"
                  android:layout_margin="7dp"
                  android:scrollbars="vertical"/&gt;
  
              &lt;ImageView
                  android:id="@+id/iv_infopicture"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_below="@+id/tv_infotext"
                  android:layout_margin="7dp"/&gt;
          &lt;/LinearLayout&gt;
  
      &lt;/ScrollView&gt;
  
  &lt;/LinearLayout&gt;
  
  &lt;View
      android:layout_width="fill_parent"
      android:layout_height="1dp"
      android:layout_alignTop="@+id/layout_progressbar"
      android:layout_marginTop="5dp"
      android:layout_toEndOf="@+id/iv_image"
      android:layout_toRightOf="@+id/iv_image"
      android:background="?android:attr/listDivider"/&gt;
  
  &lt;RelativeLayout
      android:id="@+id/layout_progressbar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:layout_toEndOf="@+id/view"   
  android:layout_toRightOf="@+id/view" android:gravity="bottom"  
  android:orientation="horizontal"&gt;
  
      &lt;ImageButton
          android:id="@+id/bt_next"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentEnd="true"
          android:layout_alignParentRight="true"
          android:layout_marginTop="5dp"
          android:enabled="false"
          android:src="@drawable/ic_arrow_right"
          android:text="@string/next"/&gt;
  
      &lt;ImageButton
          android:id="@+id/bt_info"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginRight="16dp"
          android:layout_marginTop="15dp"
          android:layout_toLeftOf="@+id/bt_next"
          android:layout_toStartOf="@+id/bt_next"
          android:background="@null"
          android:src="@drawable/ic_info"
          android:visibility="invisible"/&gt;
  
      &lt;TextView
          android:id="@+id/tv_resultmessage"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_margin="15dp"/&gt;
  
      &lt;ImageButton
          android:id="@+id/bt_back"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginTop="5dp"
          android:src="@drawable/ic_arrow_left"
          android:text="@string/back"/&gt;
  
      &lt;ProgressBar
          android:id="@+id/pb_quiz"
          style="?android:attr/progressBarStyleHorizontal"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@+id/bt_back"
          android:layout_marginLeft="5dp"
          android:layout_marginRight="5dp"
          android:progress="1"/&gt;
  &lt;/RelativeLayout&gt;
  &lt;ImageView
      android:id="@+id/iv_image"
      android:layout_width="150dp"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_below="@id/toolbar" android:src="@drawable/schmuck"/&gt;
  </code></pre>
  
  <p></p>
  
  <p><a href="https://i.stack.imgur.com/ErpH8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ErpH8.png" alt="enter image description here"></a></p>
  
  <p>Do you know a solution for this?</p>