title: Adjust GridView to all Screen Sizes
body: <p>Im trying to implement a GridView as part of a image gallery. I followed the following example from the <a href="http://developer.android.com/guide/topics/ui/layout/gridview.html" rel="noreferrer">Android developer portal</a>.</p>
  
  <p>The tutorial seems to work for all screen sizes. As you can see below the proportions for a small and a large screen size are displayed correctly (on the left - small screen size, on the right - large screen size.</p>
  
  <p><img src="https://i.stack.imgur.com/mESoV.png" alt="GridView tutorial from android developer portal"></p>
  
  <p>But now to my problem. When I want to implement exactly the same GridView within a LinearLayout from my Android Project - the correct proportions are gone - as shown by the images below. The pictures begin to overlap so forth and so on.</p>
  
  <p><img src="https://i.stack.imgur.com/3Urf9.png" alt="My android project"></p>
  
  <p>I am quite sure that this has something to with my LinearLayout which looks like the following.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/widget64"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical"&gt;
  
      &lt;LinearLayout
              android:id="@+id/widget34"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:padding="5dp"
              android:background="@drawable/foto_detail_bg_cell_0"
              &gt;
          &lt;ImageView
                  android:id="@+id/flyer"
                  android:layout_width="100dp"
                  android:layout_height="80dp"
                  android:src="@drawable/icon"
                  android:scaleType="centerCrop"
                  /&gt;
          &lt;LinearLayout
                  android:id="@+id/widget36"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="5px"
                  android:orientation="vertical"&gt;
              &lt;TextView
                      android:id="@+id/toptext"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Beat.It"
                      android:textSize="16sp"
                      android:textStyle="bold"
                      android:textColor="@color/white"/&gt;
              &lt;TextView
                      android:id="@+id/widget39"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="http://www.google.at"
                      android:textColor="@color/white"/&gt;
              &lt;LinearLayout
                      android:id="@+id/widget40"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"&gt;
                  &lt;ImageView
                          android:id="@+id/widget41"
                          android:layout_width="58dp"
                          android:layout_height="40dp"
                          android:src="@drawable/facebook_share"/&gt;
                  &lt;ImageView
                          android:id="@+id/widget42"
                          android:layout_width="58dp"
                          android:layout_height="40dp"
                          android:layout_marginLeft="1dp"
                          android:src="@drawable/photocount"/&gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
      &lt;GridView xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/gridview"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:columnWidth="90dp"
                android:numColumns="auto_fit"
                android:verticalSpacing="10dp"
                android:horizontalSpacing="10dp"
                android:stretchMode="columnWidth"
                android:gravity="center"
              /&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>The MAIN QUESTION:</strong>
  The Layout XML used by the tutorial on the <a href="http://developer.android.com/guide/topics/ui/layout/gridview.html" rel="noreferrer">Android developer portal</a> only uses the GridView alone, without a LinearLayout and and it is shown with correct proportions on each screen size. Why is that? And why does it not work properly when I nest the GridView in a Linear Layout like in my project?</p>