title: Android Grid layout is not working as expected
body: <p>I have a grid layout in my android application. but it displays different in some other device.</p>
  <p>code is given below.</p>
  <p><strong>Listing page ;-</strong></p>
  
  <p></p>
  <pre><code>&lt;include layout=&quot;@layout/action_bar&quot; /&gt;
  
  &lt;LinearLayout
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layout_below=&quot;@+id/headerBar&quot;
      android:layout_marginTop=&quot;10dp&quot;
      android:orientation=&quot;horizontal&quot;&gt;
  
      &lt;GridView
          android:id=&quot;@+id/listView&quot;
          android:layout_margin=&quot;5dp&quot;
          android:divider=&quot;@null&quot;
          android:elevation=&quot;5dp&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          android:gravity=&quot;center&quot;
          android:columnWidth=&quot;200dp&quot;
          android:numColumns=&quot;auto_fit&quot;
          android:verticalSpacing=&quot;24dp&quot;
          android:horizontalSpacing=&quot;10dp&quot;
          android:stretchMode=&quot;spacingWidthUniform&quot;&gt;
  
      &lt;/GridView&gt;
  &lt;/LinearLayout&gt;
  
  &lt;com.google.android.material.floatingactionbutton.FloatingActionButton
      android:id=&quot;@+id/fabBtnUploadFile&quot;
      android:layout_width=&quot;wrap_content&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layout_gravity=&quot;bottom|end&quot;
      android:layout_margin=&quot;16dp&quot;
      android:tint=&quot;@color/White&quot;
      android:layout_alignParentBottom=&quot;true&quot;
      android:layout_alignParentRight=&quot;true&quot;
      app:backgroundTint=&quot;@color/appThemeColor&quot;
      app:srcCompat=&quot;@android:drawable/ic_input_add&quot;
      android:visibility=&quot;gone&quot;/&gt;
  </code></pre>
  
  <p><strong>Listing item</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layout_gravity=&quot;center&quot;
      android:layout_margin=&quot;10dp&quot;
      android:padding=&quot;5dp&quot;
      android:background=&quot;@drawable/myrect&quot;&gt;
  
      &lt;ImageView
          android:id=&quot;@+id/pdfIcon&quot;
          android:layout_width=&quot;100dp&quot;
          android:layout_height=&quot;100dp&quot;
          android:src=&quot;@drawable/ic_pdf&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          tools:layout_editor_absoluteY=&quot;8dp&quot;/&gt;
  
      &lt;TextView
          android:id=&quot;@+id/txtItemName&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_alignBottom=&quot;@+id/pdfIcon&quot;
          android:layout_gravity=&quot;center&quot;
          android:layout_margin=&quot;5dp&quot;
          android:fontFamily=&quot;@font/geometria_bold&quot;
          android:inputType=&quot;textCapSentences|textCapCharacters|textCapWords&quot;
          android:padding=&quot;5dp&quot;
          android:text=&quot;name of item&quot;
          android:textColor=&quot;@color/Black&quot;
          android:textSize=&quot;@dimen/medium&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toBottomOf=&quot;@+id/pdfIcon&quot; /&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <p>Images for display outcome.</p>
  <p><strong>correct result image</strong>
  <a href="https://i.stack.imgur.com/7IDxQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7IDxQ.jpg" alt="enter image description here" /></a></p>
  <p><strong>Wrong display for same</strong></p>
  <p><a href="https://i.stack.imgur.com/LWnFu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LWnFu.jpg" alt="enter image description here" /></a></p>
  <p>Can anyone suggest where i am doing wrong ?</p>