title: android how to auto shrink imageview according to the screen size in tablayout?
body: <p>I set 4 table rows weight to be 1. it works very well in different screen sizes. It will auto shrink and display all the images and fit the screen.</p>
  
  <p><strong>But when i place it inside the Tablayout fragment, the content doesn't show all; as you can see from the screenshot.</strong> Anyone know wads the problem ? Thx.</p>
  
  <p><a href="https://i.stack.imgur.com/YK32v.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YK32v.jpg" alt="enter image description here"></a></p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  tools:context="com.example.template_tab.frag_two"
  android:orientation="vertical"&gt;
  
  &lt;TableRow
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"&gt;
  
      &lt;ImageView
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:id="@+id/img0"
          android:src="@drawable/sample_0"
          android:layout_weight="1" /&gt;
  
      &lt;ImageView
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:id="@+id/img1"
          android:src="@drawable/sample_1"
          android:layout_weight="1" /&gt;
  
      &lt;ImageView
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:id="@+id/img2"
          android:src="@drawable/sample_2"
          android:layout_weight="1" /&gt;
  
      &lt;ImageView
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:id="@+id/img3"
          android:src="@drawable/sample_3"
          android:layout_weight="1" /&gt;
  &lt;/TableRow&gt;
  
  &lt;TableRow
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"&gt;
      &lt;ImageView
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:id="@+id/img4"
          android:src="@drawable/sample_4"
          android:layout_weight="1" /&gt;
  
      &lt;ImageView
          android:layout_width="9dp"
          android:layout_height="wrap_content"
          android:id="@+id/img5"
          android:src="@drawable/sample_5"
          android:layout_weight="1" /&gt;
  
      &lt;ImageView
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:id="@+id/img6"
          android:src="@drawable/sample_6"
          android:layout_weight="1" /&gt;
  
      &lt;ImageView
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:id="@+id/img7"
          android:src="@drawable/sample_7"
          android:layout_weight="1" /&gt;
  
  &lt;/TableRow&gt;
  
  &lt;TableRow
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"&gt;
      &lt;ImageView
          android:layout_width="9dp"
          android:layout_height="wrap_content"
          android:id="@+id/img8"
          android:src="@drawable/sample_8"
          android:layout_weight="1" /&gt;
  
      &lt;ImageView
          android:layout_width="9dp"
          android:layout_height="wrap_content"
          android:id="@+id/img9"
          android:src="@drawable/sample_9"
          android:layout_weight="1" /&gt;
  
      &lt;ImageView
          android:layout_width="9dp"
          android:layout_height="wrap_content"
          android:id="@+id/img10"
          android:src="@drawable/sample_10"
          android:layout_weight="1" /&gt;
  
      &lt;ImageView
          android:layout_width="9dp"
          android:layout_height="wrap_content"
          android:id="@+id/img11"
          android:src="@drawable/sample_11"
          android:layout_weight="1" /&gt;
  
  &lt;/TableRow&gt;
  
  &lt;TableRow
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1"&gt;
  
      &lt;ImageView
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:id="@+id/result"
          android:src="@drawable/sample_0"
          android:layout_weight="1" /&gt;
  
      &lt;TextView
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:textAppearance="?android:attr/textAppearanceLarge"
          android:id="@+id/display_text"
          android:text="1908, 1920, 1932, 1944, 1956, 1968, 1980, 1992, 2004, 2016, 2028, 2040, 2052, 2064"
          android:layout_weight="1" /&gt;
  &lt;/TableRow&gt;
  &lt;/LinearLayout&gt;
  </code></pre>