title: Android drawSelectorOnTop with GridView
body: <p>I am developing a tabbed application in which one of the fragments, CollectionsFragment, contains a GridView with an ImageView in each slot.  I would like the to use a selector to give feedback to users when the user clicks on one of the images.  </p>
  
  <p>I have successfully implemented the selector, however, my problem is that the selector is only drawing in the background of the image, but I would like to the selector to draw over the entire image.  I have seen this problem referenced elsewhere, however, the solution selected by many, setting the drawSelectorOnTop property of the GridView, is not working for me.</p>
  
  <p>The relevant fragment with the relevant adapter code:</p>
  
  <pre><code>public class CollectionsFragment extends Fragment {
      @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                  Bundle savedInstanceState) {
               View view = inflater.inflate(R.layout.activity_collections, container, false);
               // Grid view is inside the xml view inflated above
               GridView gridView = (GridView)view.findViewById(R.id.gridview);
               gridView.setDrawSelectorOnTop(true);
               ((GridView) gridView).setAdapter(new CustomGridViewAdapter(getActivity()));
               return view;
          }
  
          private class CustomGridViewAdapter extends BaseAdapter {
              @Override
              public View getView(int i, View view, ViewGroup viewGroup) {
                  View v = view;
                  ImageView picture;
                  TextView name;
  
                  if(v == null) {
                      v = inflater.inflate(R.layout.collections_item, viewGroup, false);
                      v.setTag(R.id.picture, v.findViewById(R.id.picture));
                      v.setTag(R.id.text, v.findViewById(R.id.text));
                  }
  
                  picture = (ImageView)v.getTag(R.id.picture);
  
                  name = (TextView)v.getTag(R.id.text);
  
                  Item item = (Item)getItem(i);
                  name.setText(item.name);
  
                  picture.setImageResource(item.drawableId);
                  picture.setBackgroundResource(R.drawable.selector);
  
                  return v;
              }
          }
  }
  </code></pre>
  
  <p>And my selector for completeness sake:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;item android:state_pressed="true" 
        android:drawable="@color/buttonhighlight"/&gt; &lt;!-- pressed state --&gt;
  &lt;item android:state_focused="true" 
        android:drawable="@color/buttonhighlight"/&gt; &lt;!-- focused state --&gt;
  &lt;item android:drawable="@android:color/transparent"/&gt; &lt;!-- default state --&gt; 
  &lt;/selector&gt;
  </code></pre>
  
  <p>Thanks for any help,</p>