title: Change color of element OnItemClick in GridView
body: <p>I'm working with ListViews and a GridView in my app. I've used a custom adapter for the GridView but not for the list. </p>
  
  <p><img src="https://i.stack.imgur.com/hzD2M.png" alt="enter image description here"></p>
  
  <p>As you can see, automatically it changes the background of the element when I click on it. But in the GridView is not happening the same. Have I got to do it manually? I would like some feedback for the user, the typical border or something like that. I upload the gridview screenshot too.</p>
  
  <p><img src="https://i.stack.imgur.com/cakpt.png" alt="enter image description here"></p>
  
  <p>The GridView XML.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;GridView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/gridView"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:columnWidth="100dp"
  android:drawSelectorOnTop="true"
  android:gravity="center"
  android:horizontalSpacing="10dp"
  android:numColumns="auto_fit"
  android:stretchMode="columnWidth"
  android:verticalSpacing="10dp" &gt;
  </code></pre>
  
  <p></p>
  
  <p>And now the GridView Adapter's getView() part:</p>
  
  <pre><code>@Override
  public View getView(int position, View convertView, ViewGroup parent) {
  
      View layout=convertView;
      ViewHolder holder = null;
      GridCrop gridElement;
  
      if (layout == null) {
          LayoutInflater inflater = LayoutInflater.from(parent.getContext());
          layout=inflater.inflate(R.layout.crop_grid_element,null);
          holder = new ViewHolder();
          holder.image = (ImageView) layout.findViewById(R.id.cropImage);
          holder.text = (TextView) layout.findViewById(R.id.imageTitle);
          layout.setTag(holder);
      } else {
          holder = (ViewHolder) layout.getTag();
      }
  
      gridElement=list.get(position);
      holder.image.setImageResource(gridElement.getImage());
      holder.text.setText(gridElement.getTitle());
      return layout;
  }
  
  class ViewHolder {
      ImageView image;
      TextView text;
  }
  </code></pre>