Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid layout weights broken down by ImageView
    primarykey
    data
    text
    <p>I'm creating an activity. It has a main menu. Here is my xml;</p> <p></p> <pre><code> &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" &gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="4" android:orientation="horizontal" &gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="8" &gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="84" android:background="@drawable/main_menu_background_shape" android:orientation="vertical" &gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" &gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" &gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" &gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" &gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" &gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" &gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" &gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" &gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="8" &gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" &gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>And it's output like this;</p> <p><img src="https://i.stack.imgur.com/zUn0w.png" alt="enter image description here"></p> <p>I want to add images into the numbered areas. When I add them, Here is the xml.</p> <p></p> <pre><code> &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" &gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="4" android:orientation="horizontal" &gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="8" &gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="84" android:background="@drawable/main_menu_background_shape" android:orientation="vertical" &gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" &gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/main_menu_katilimcilar" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/imageView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/main_menu_etkinlikler" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/imageView4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/main_menu_imza_gunleri" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" &gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/imageView5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/main_menu_fuar_haritasi" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/imageView6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/main_menu_fuar_hakkinda" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/imageView7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/main_menu_paylas" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="8" &gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" &gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>The output like this;</p> <p><img src="https://i.stack.imgur.com/roUrP.png" alt="enter image description here"></p> <p>Layout weights lost because of the images. I want to scale images(with it's aspect ratio) and make layouts not to lost weights.</p> <p>How can I do it?</p> <p><strong>EDIT:</strong> After @pratik's answer here is the output;</p> <p><img src="https://i.stack.imgur.com/mDEsh.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload