title: Android Gridview getting focus
body: <p>I have a Linear Layout and at the very bottom i have a gridview (hotelsGrid) that i populate with more items to see, the problem is that after i set my adapter the view on the screen jumps to the bottom to show the gridview and i need to stay on the top, how can i archieve this?</p>
  
  <p>Here is my XML:</p>
  
  <pre><code>&lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/hotel_detail"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      tools:context=".ActivityHotelDetail"&gt;
  
      &lt;android.support.design.widget.AppBarLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
          &lt;include
              android:id="@+id/toolbar"
              layout="@layout/toolbar"/&gt;
  
          &lt;android.support.design.widget.TabLayout
              android:id="@+id/tabs"
              android:layout_width="match_parent"
              android:layout_height="40dp"
              android:background="@color/colorPrimaryDark"
              android:hapticFeedbackEnabled="true"
              app:tabGravity="fill"
              app:tabIndicatorColor="@color/colorPrimary"
              app:tabIndicatorHeight="3dp"
              app:tabMode="fixed"/&gt;
  
      &lt;/android.support.design.widget.AppBarLayout&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/viewpager"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:layout_behavior="@string/appbar_scrolling_view_behavior" /&gt;
  
      &lt;ScrollView
          android:id="@+id/mainScroll"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_margin="@dimen/activity_vertical_margin"
                  android:background="@drawable/panel_with_border_nopadding"
                  android:orientation="vertical"&gt;
  
                  &lt;TextView
                      android:id="@+id/hotelName"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:background="@drawable/fondo_titulo"
                      android:gravity="center"
                      android:paddingBottom="10sp"
                      android:text="Nombre del Hotel"
                      android:textAppearance="@android:style/TextAppearance.Large"
                      android:textColor="@color/textColorPrimary"
                      android:textSize="28sp"/&gt;
  
                  &lt;ImageView
                      android:id="@+id/hotelMainImage"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:adjustViewBounds="true"
                      android:paddingLeft="1dp"
                      android:paddingRight="1dp"
                      android:scaleType="fitCenter"
                      android:src="@drawable/fondo_360"/&gt;
  
                  &lt;LinearLayout
                      android:id="@+id/video360"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:orientation="vertical"
                      android:visibility="gone"&gt;
  
                      &lt;FrameLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:layout_alignParentTop="true"
                          android:layout_centerHorizontal="true"&gt;
  
                          &lt;com.google.vr.sdk.widgets.video.VrVideoView
                              android:id="@+id/video_view"
                              android:layout_width="match_parent"
                              android:layout_height="250dip"
                              android:scrollbars="@null"/&gt;
  
                          &lt;ImageView
                              android:id="@+id/playButton"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_gravity="center"
                              android:layout_marginBottom="10dip"
                              android:adjustViewBounds="true"
                              android:background="@drawable/playbutton"
                              android:scaleType="fitXY"/&gt;
                      &lt;/FrameLayout&gt;
  
                      &lt;LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:orientation="horizontal"&gt;
  
                          &lt;ImageButton
                              android:id="@+id/play_toggle"
                              android:layout_width="0dp"
                              android:layout_height="wrap_content"
                              android:layout_weight="1"
                              android:background="@android:color/transparent"
                              android:paddingStart="0dp"
                              android:paddingTop="4dp"
                              android:src="@drawable/play_on"/&gt;
                          &lt;!-- Seeking UI &amp; progress indicator.--&gt;
                          &lt;SeekBar
                              android:id="@+id/seek_bar"
                              style="?android:attr/progressBarStyleHorizontal"
                              android:layout_width="0dp"
                              android:layout_height="32dp"
                              android:layout_weight="8"/&gt;
  
                          &lt;ImageButton
                              android:id="@+id/volume_toggle"
                              android:layout_width="0dp"
                              android:layout_height="wrap_content"
                              android:layout_weight="1"
                              android:background="@android:color/transparent"
                              android:paddingStart="0dp"
                              android:paddingTop="4dp"
                              android:src="@drawable/volume_on"/&gt;
                      &lt;/LinearLayout&gt;
                  &lt;/LinearLayout&gt;
  
                  &lt;TextView
                      android:id="@+id/hotelDistance"
                      android:layout_width="match_parent"
                      android:layout_height="26sp"
                      android:layout_marginBottom="@dimen/activity_vertical_margin"
                      android:layout_marginLeft="1dp"
                      android:layout_marginRight="1dp"
                      android:background="@drawable/fondo_distancia"
                      android:gravity="center"
                      android:text="distance"
                      android:textColor="@color/textColorPrimary"/&gt;
  
                  &lt;TextView
                      android:id="@+id/hotelAddress"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_alignParentStart="true"
                      android:layout_below="@+id/imagepreview"
                      android:layout_marginBottom="@dimen/activity_vertical_margin"
                      android:gravity="center"
                      android:text="Direccion"
                      android:textColor="@color/textColorSecundary"/&gt;
  
                  &lt;TextView
                      android:id="@+id/hotelDescription"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginBottom="@dimen/activity_vertical_margin"
                      android:gravity="center"
                      android:paddingLeft="@dimen/activity_horizontal_margin"
                      android:paddingRight="@dimen/activity_horizontal_margin"
                      android:text="Descripcion"/&gt;
              &lt;/LinearLayout&gt;
  
              &lt;RelativeLayout
                  android:id="@+id/otherHotelsRL"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_marginLeft="@dimen/activity_vertical_margin"
                  android:layout_marginRight="@dimen/activity_vertical_margin"
                  android:layout_marginTop="20dp"
                  android:background="@drawable/panel_with_border_nopadding"
                  android:paddingLeft="1dp"
                  android:paddingRight="1dp"&gt;
  
                  &lt;TextView
                      android:id="@+id/otherViewsTxt"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:gravity="center"
                      android:paddingBottom="10dp"
                      android:paddingTop="10dp"
                      android:text="Fotos"
                      android:textColor="@color/textColorSecundary"
                      android:textSize="22sp"/&gt;
  
                  &lt;HorizontalScrollView
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:layout_alignParentStart="true"
                      android:layout_below="@+id/otherViewsTxt"
                      android:layout_marginBottom="10dp"
                      android:fillViewport="true"&gt;
  
                      &lt;LinearLayout
                          android:layout_width="wrap_content"
                          android:layout_height="match_parent"
                          android:orientation="horizontal"&gt;
  
                          &lt;ImageView
                              android:id="@+id/thumb1"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_marginEnd="5dp"
                              android:layout_weight="1"
                              android:src="@mipmap/icon_360"/&gt;
  
                          &lt;ImageView
                              android:id="@+id/thumb2"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_below="@+id/thumb1"
                              android:layout_marginEnd="5dp"
                              android:layout_weight="1"
                              android:src="@mipmap/icon_360"/&gt;
  
                          &lt;ImageView
                              android:id="@+id/thumb3"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_below="@+id/thumb2"
                              android:layout_weight="1"
                              android:src="@mipmap/icon_360"/&gt;
                      &lt;/LinearLayout&gt;
                  &lt;/HorizontalScrollView&gt;
  
                  &lt;ImageView
                      android:id="@+id/imageView"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignParentStart="true"
                      android:layout_centerVertical="true"
                      android:layout_weight="1"
                      android:alpha="0.8"
                      android:background="#222222"
                      app:srcCompat="@drawable/ic_chevron_left_white_24dp"/&gt;
  
                  &lt;ImageView
                      android:id="@+id/imageView2"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignParentEnd="true"
                      android:layout_centerVertical="true"
                      android:layout_weight="1"
                      android:alpha="0.8"
                      android:background="#222222"
                      app:srcCompat="@drawable/ic_chevron_right_white_24dp"/&gt;
              &lt;/RelativeLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_marginBottom="30dp"
                  android:layout_marginLeft="@dimen/activity_vertical_margin"
                  android:layout_marginRight="@dimen/activity_vertical_margin"
                  android:layout_marginTop="20dp"
                  android:orientation="vertical"
                  android:paddingBottom="1dp"
                  android:paddingLeft="1dp"
                  android:paddingRight="1dp"&gt;
  
                  &lt;TextView
                      android:id="@+id/otherHotelsTxt"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginBottom="5dp"
                      android:background="@drawable/panel_with_border_padding"
                      android:gravity="center"
                      android:paddingBottom="10dp"
                      android:paddingTop="10dp"
                      android:text="Mas Hoteles Interesantes"
                      android:textColor="@color/textColorSecundary"
                      android:textSize="22sp"/&gt;
  
                  &lt;GridView
                      android:id="@+id/hotelsGrid"
                      android:layout_width="match_parent"
                      android:layout_height="350dp"
                      android:layout_marginTop="@dimen/activity_vertical_margin"
                      android:horizontalSpacing="15dp"
                      android:numColumns="2"
                      android:stretchMode="columnWidth"
                      android:verticalSpacing="15dp"/&gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/ScrollView&gt;
  &lt;/LinearLayout&gt;
  </code></pre>