title: Custom item for Gridview not inflated properly
body: <p>I have the following Gridview inside a fragment layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/gallery"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"&gt;
  
  &lt;GridView xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/grid_view_photos"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:horizontalSpacing="10dp"
      android:numColumns="auto_fit"
      android:stretchMode="columnWidth"
      android:verticalSpacing="10dp"
      android:background="@android:color/darker_gray"/&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>and this is the custom item made for the Gridview:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:orientation="horizontal"
  android:padding="5dp"&gt;
  
  &lt;ImageView
      gra
      android:id="@+id/image_view_gallery"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginRight="10dp"
      android:layout_centerInParent="true"/&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>and here is the adapter's getView method:</p>
  
  <pre><code>@Override
  public View getView(int position, View convertView, ViewGroup parent) {
      ImageView imageView;
      if (convertView == null) {
          convertView = inflater.inflate(R.layout.item_photos_grid_view, null);
          imageView = (ImageView) convertView.findViewById(R.id.image_view_gallery);
          imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
  
      } else {
          imageView = (ImageView) convertView;
          imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
      }
      Glide.with(context) //
              .load(PhotosFragmentConstants.IMAGES[position])
              .diskCacheStrategy(DiskCacheStrategy.SOURCE)
              .crossFade()
              .centerCrop()
              .into(imageView);
  
  
       return imageView;
  </code></pre>
  
  <p>so the image should have a border because of the relative layout. The image has set layout margins so it creates a border effect, but it  doesn't work.
  When i run the app,  you can see only the image view and there is not layout behind him.</p>
  
  <p>Is there a way that i need to make the item for the gridview so it will display it properly? 
  Thank you for the help!</p>